multiple curves on single vPython plot -
i put 2 curves on 1 vpython plot. possible?
i opening curve with:
gd = gdisplay(x=300, y=0, width=600, height=600, title='entropy', xtitle='time', ytitle='n', foreground=color.black, background=color.red, xmax=250, xmin=0, ymax=400, ymin=0.) funct1=gcurve(color=color.white)
i updating single curve inside while loop
funct1.plot(pos=(bigindex,entropy))
along plotting entropy on graph, i'd plot number of particles in particular position. 1 set of axis, 2 curves. each curve undated inside loop students can see 1 curve grow other decreases.
is possible?
simply create gcurve object. update both curves simultanously in while loop using plot command. example:
from visual import * visual.graph import * gd = gdisplay(x=300, y=0, width=600, height=600, title='entropy', xtitle='time', ytitle='n', foreground=color.black, background=color.white, xmax=250, xmin=0, ymax=400, ymin=0.) funct1=gcurve(color=color.black) funct2=gcurve(color=color.black) in range(0,200): funct1.plot(pos=(i,i*2)) funct2.plot(pos=(i,400-i*2)) rate(20)
Comments
Post a Comment