multiple parametric_plot's with for loop

i like this post (click again to cancel)
1
i dont like this post (click again to cancel)

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)

asked May 21 '12

this post is marked as community wiki

This post is a wiki. Anyone with karma >150 is welcome to improve it.

updated May 21 '12

calc314 gravatar image calc314
1855 3 19 53
i like this answer (click again to cancel)
2
i dont like this answer (click again to cancel)

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))
link

answered May 21 '12

this post is marked as community wiki

This post is a wiki. Anyone with karma >150 is welcome to improve it.

updated May 21 '12

ndomes gravatar image ndomes
536 7 16

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Tags:

Stats:

Asked: May 21 '12

Seen: 69 times

Last updated: May 21 '12

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.