up [pdf]
from rsf.proj import *

def wiggle(title):
    return '''
    wiggle yreverse=y label1=Space wantaxis1=n label2=Time
    clip=1 labelsz=16 titlesz=18 title="%s"
    ''' % title

Flow('im',None,'heat impl=y alpha=2')
Plot('im',wiggle('Implicit, a=2'))
for case in (0,1):
    ex = 'ex%d' % case
    alpha = 2+2*case
    title = 'Explicit, a=%d/3' % alpha
    Flow(ex,None,'heat impl=n alpha=%g' % (alpha/3.0))
    Plot(ex,wiggle(title))

Result('heat','ex0 ex1 im','SideBySideAniso')

Flow('heat3',None,'heat3 n3=40 nh=15')
steps=[]
for step in (0,10,20):
    heat = 'heat-%d' % step
    Flow(heat,'heat3','window n3=1 f3=%d' % step)
    Plot(heat,
         '''
         grey allpos=y pclip=100 wantaxis=n
         label1=X label2=Y labelsz=16 titlesz=18 title="Time=%d"
         ''' % step)
    steps.append(heat)
Result('heat3d',steps,'SideBySideAniso')

Flow('mean','heat3',
     'stack axis=1 norm=n | stack axis=1 norm=n | scale axis=1')
Flow('max','heat3','put n1=1 n2=10000 | stack max=y | window')

Result('heat-mean','mean max',
       '''
       cat axis=2 ${SOURCES[1]} |
       graph label1=Time label2=Temperature dash=0,1 title="Heat conduction"
       ''')

End()

sfheat
sfwiggle
sfheat3
sfwindow
sfgrey
sfstack
sfscale
sfput
sfcat
sfgraph