# multiple parametric_plot's with for loop This post is a wiki. Anyone with karma >750 is welcome to improve it.

I'm studying differential geometry of curves and surfaces, and I have a question regarding multiple plots on one graphics, that is i want to plot multiple lines on one plot in for loop, but when I try to do that it shows only the last plot...

a,b,v,u = var('a b v u'); rectangular=(a,b,v);
z=0;
for i in range(81):
z=i*pi/20;z
pt=plot3d(z*v,(v,0,5),(a,0,5),(b,0,5),transformation=rectangular,plot_points=80,color="blue")
show(pt)

edit retag close merge delete

Sort by » oldest newest most voted This post is a wiki. Anyone with karma >750 is welcome to improve it.

You have to 'add' the plots.
I guess you want do something like the following:

a,b,v,u = var('a b v u');
rectangular=(a,b,v);
pt = Graphics()
for i in range(3):
z=i*pi/20
pt += plot3d(z*v,(v,0,5),(a,0,5),(b,0,5),transformation=rectangular,plot_points=80,opacity=0.5)
show(pt)


alternatively you can use list comprehension

plots = [ plot3d(i*pi/20*v,(v,0,5),(a,0,5),(b,0,5),transformation=rectangular,plot_points=80 ) for i in range(3) ]

show(sum(plots))

more