Ask Your Question
1

multiple parametric_plot's with for loop

asked 2012-05-21 06:47:33 +0100

this post is marked as community wiki

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-05-21 09:37:54 +0100

this post is marked as community wiki

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))
edit flag offensive delete link more

Comments

This helped me in drawing a collection of logarithmic spirals. Thank you.

var('r');var('theta')
r0=.5;

k_list = [N(k/10) for k in range(3,10,1)]
#print(k_list)

p = Graphics()

for n in range(6):
    r = r0*exp(k_list[n]*theta)
    p += polar_plot(r,(theta,0,2*pi),plot_points = 100)

p.show(aspect_ratio = 1)
SP1605 gravatar imageSP1605 ( 2024-08-13 18:02:48 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-05-21 06:47:33 +0100

Seen: 739 times

Last updated: May 21 '12