2

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!

1
  • 1
    That seems to be a bug. It works with 4.4.4, but not with 4.6.0 or the current development version. I reported the bug at sourceforge.net/p/gnuplot/bugs/1314 Commented Jan 3, 2014 at 15:12

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, Ethan. I'll give it a try once I can get 4.7 installed. Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.