Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Plotting successive 3D plots in a for loop (only the last one can be plotted!)

Hi, I have another problem with plotting multiple 3D plots. When I execute the following two cells in the notebook interface: Cell 1: (Definition of function that generates parametrized plots) def plotPerceFL1 (aalpha): p1_11 = plot3d(Fp1_11(alpha=aalpha),(x,0,1),(y,0,1),color="red") p1_12 = plot3d(Fp1_12(alpha=aalpha),(x,0,1),(y,0,1),color="gray") return p1_11+p1_12

Cel 2: (Plotting successive plots for different values of aalpha) for a in srange(-1,1,step=0.25): grr=plotPerceFL1(a) grr.show()

I can see the loop running (if I print a, for example) but nothing is plotted until the end of the loop, then only the last graphic is shown.

Is there any trick to force Sage to successively plotting all graphics (and, preferably, to keep them in the screen one below the other)?

Thanks in advance for your help. Murat

Plotting successive 3D plots in a for loop (only the last one can be plotted!)

Hi, I have another problem with plotting multiple 3D plots. When I execute the following two cells in the notebook interface: interface:

Cell 1: (Definition of function that generates parametrized plots) plots)

def plotPerceFL1 (aalpha):
   p1_11 = plot3d(Fp1_11(alpha=aalpha),(x,0,1),(y,0,1),color="red")
   p1_12 = plot3d(Fp1_12(alpha=aalpha),(x,0,1),(y,0,1),color="gray")
   return p1_11+p1_12

p1_11+p1_12

Cel 2: (Plotting successive plots for different values of aalpha) aalpha)

for a in srange(-1,1,step=0.25):
   grr=plotPerceFL1(a)
   grr.show() 

grr.show()

I can see the loop running (if I print a, for example) but nothing is plotted until the end of the loop, then only the last graphic is shown.

Is there any trick to force Sage to successively plotting all graphics (and, preferably, to keep them in the screen one below the other)?

Thanks in advance for your help. Murat