Reputation: 123
I am trying to plot multiple parametric curves in gnuplot 4.6.
In an earlier version (4.4?), the commands
set para
plot [-pi:pi] for [a=1:10] a*cos(t),a*sin(t)
would result in ten circles centered at the origin with radius 1, 2, ..., 10. In 4.6, the result is one circle of radius 1.
In 4.6, the commands
unset para
plot [-pi:pi] for [a=1:10] a*sin(x)
yield ten beautiful sine curves.
So, it appears that the "for" command now has a problem with parametric curve plotting, I guess.
Does anyone know of a workaround? The circle object is not useful for me: I am interested in general curves. Thanks!
Upvotes: 2
Views: 628
Reputation: 46
The syntax ambiguity between parametric mode and iteration is a documented bug/limitation in current gnuplot versions. In the development version (4.7) a separate parametric mode is not necessary, as the required sampling variable can be explicitly described in a generic plot command:
plot for [a=1:10] [t=-10:10] '+' using (a*sin(t)):(a*cos(t))
Unfortunately that fully general syntax is not available in version 4.6. The closest I can think of is a simpler variant:
unset parametric
plot for [a=1:10] '+' using (a*sin($1)):(a*cos($1))
This works for your example case, but may not suffice for your actual use case because it conflates the sampling range on the parametric variable with the implicit plotting range on x.
Upvotes: 3