Menu

#1314 For iteration not working in parametric mode

closed-fixed
nobody
None
5
2015-03-23
2014-01-03
No

The plot for iteration in parametric mode doesn't work. Consider the following script:

set parametric
set trange[-pi:pi]
plot for [a=1:10] a*cos(t), a*sin(t)

With 4.4.4 it produces 10 circles around the origin, as expected. Since 4.6.0 (tested also with current CVS 2014-01-01), it gives only a single plot with a = 1 (see http://stackoverflow.com/questions/20895415/for-loop-with-parametric-plots-in-gnuplot).

Discussion

  • Christoph Bersch

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -6,4 +6,4 @@
     plot for [a=1:10] a*cos(t), a*sin(t)
     ~~~~~~
    
    -With 4.4.4 it produces 10 circles around the origin, as expected. Since 4.6.0 (tested also with current CVS 2014-01-01), it gives only a single plot with `a = 1`.
    +With 4.4.4 it produces 10 circles around the origin, as expected. Since 4.6.0 (tested also with current CVS 2014-01-01), it gives only a single plot with `a = 1` (see http://stackoverflow.com/questions/20895415/for-loop-with-parametric-plots-in-gnuplot).
    
     
  • Ethan Merritt

    Ethan Merritt - 2014-01-03

    The syntax incompatibility between iteration and parametric mode is documented as a known bug or limitation in the development version (gnuplot 4.7). On the other hand, so far as I know the separate parametric mode is no longer needed in 4.7 because the same result can be achieved by explicitly listing the iteration variable in a generic plot command:

    plot for [a=1:10] [t=-10:10] '+' using (a*sin(t)):(a*cos(t))
    

    I had not realized (or possibly forgotten) that there existed an earlier version 4.4.x where the command in the bug report worked usefully despite the potentially ambiguous syntax.

    Anyhow, the closest equivalent work-around for 4.6 is

    unset parametric
    plot for [a=1:10] '+' using (a*sin($1)):(a*cos($1))
    

    That works, but unfortunately does not allow you to separate the sampling range on the parametric variable and the plotting range on x. So it may or may not satisfy the stackoverflow poster.

     

    Last edit: Ethan Merritt 2014-01-03
  • Ethan Merritt

    Ethan Merritt - 2014-01-10
    • status: open --> closed-fixed
     
  • Ethan Merritt

    Ethan Merritt - 2014-01-10

    Earlier behavior (4.4.x) now restored in CVS for versions 4.6 and 4.7

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.