several iterations in one plot result in sometimes missing/overwritten plots

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

several iterations in one plot result in sometimes missing/overwritten plots

thse
when using the "for" loop in a "plot" command several times, e.g.
plot for [i=1:3] x-i, for [j=1:2] x-j-5
the last "for" loop sets the internal variable "highest_iteration"
in "plot2d.c" which results in missing plots when the preceding
loops have more iterations.

example (the second plot shows the error):

reset
set xrange [-10:10]
set yrange [-10:10]
plot for [i=1:3] x-i title "i=".i, for [j=1:3] x-j-5 title "j=".j
pause -1
plot for [i=1:3] x-i title "i=".i, for [j=1:2] x-j-5 title "j=".j

adding two lines to "plot2d.c" repairs this.

--- plot2d.c.orig       2016-09-28 00:00:09.000000000 +0200
+++ plot2d.c    2016-10-26 16:40:50.238197804 +0200
@@ -2966,11 +2966,13 @@
        if (empty_iteration(plot_iterator) && this_plot) {
            this_plot->plot_type = NODATA;
        } else if (forever_iteration(plot_iterator) && (this_plot->plot_type == NODATA)) {
+           if (plot_iterator->iteration > highest_iteration)
            highest_iteration = plot_iterator->iteration;
        } else if (forever_iteration(plot_iterator) && (this_plot->plot_type == FUNC)) {
            int_error(NO_CARET,"unbounded iteration in function plot");
        } else if (next_iteration(plot_iterator)) {
            c_token = start_token;
+           if (plot_iterator->iteration > highest_iteration)
            highest_iteration = plot_iterator->iteration;
            continue;
        }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: several iterations in one plot result in sometimes missing/overwritten plots

thse
I uploaded the patch to sourceforge.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: several iterations in one plot result in sometimes missing/overwritten plots

sfeam
In reply to this post by thse
On Wednesday, 26 October, 2016 06:36:59 thse wrote:

> when using the "for" loop in a "plot" command several times, e.g.
> plot for [i=1:3] x-i, for [j=1:2] x-j-5
> the last "for" loop sets the internal variable "highest_iteration"
> in "plot2d.c" which results in missing plots when the preceding
> loops have more iterations.
>
> example (the second plot shows the error):
>
> reset
> set xrange [-10:10]
> set yrange [-10:10]
> plot for [i=1:3] x-i title "i=".i, for [j=1:3] x-j-5 title "j=".j
> pause -1
> plot for [i=1:3] x-i title "i=".i, for [j=1:2] x-j-5 title "j=".j
>
> adding two lines to "plot2d.c" repairs this.
>
> --- plot2d.c.orig       2016-09-28 00:00:09.000000000 +0200
> +++ plot2d.c    2016-10-26 16:40:50.238197804 +0200
> @@ -2966,11 +2966,13 @@
>         if (empty_iteration(plot_iterator) && this_plot) {
>             this_plot->plot_type = NODATA;
>         } else if (forever_iteration(plot_iterator) && (this_plot->plot_type
> == NODATA)) {
> +           if (plot_iterator->iteration > highest_iteration)
>             highest_iteration = plot_iterator->iteration;
>         } else if (forever_iteration(plot_iterator) && (this_plot->plot_type
> == FUNC)) {
>             int_error(NO_CARET,"unbounded iteration in function plot");
>         } else if (next_iteration(plot_iterator)) {
>             c_token = start_token;
> +           if (plot_iterator->iteration > highest_iteration)
>             highest_iteration = plot_iterator->iteration;
>             continue;
>         }

I will apply the patch since it clearly fixes a problem.

But I also suspect that the "highest_iteration" check is not needed
at all after the iteration mechanism was cleaned up last week.

Could you please test whether this test-patch causes any problems?
If it doesn't then I think we can just get rid of highest_iteration.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- gnuplot/src/plot2d.c 2016-09-27 15:00:09.000000000 -0700
+++ gnuplot-cvs/src/plot2d.c 2016-10-26 11:33:32.370040018 -0700
@@ -3335,10 +3337,8 @@ eval_plots()
 
     /* Iterate-over-plot mechanism */
     if (next_iteration(plot_iterator)) {
- if (plot_iterator->iteration <= highest_iteration) {
     c_token = start_token;
     continue;
- }
     }
 
     plot_iterator = cleanup_iteration(plot_iterator);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        Ethan



------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive.
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: several iterations in one plot result in sometimes missing/overwritten plots

thse
On Wed, Oct 26, 2016 at 11:40:33AM -0700, Ethan A Merritt wrote:

> But I also suspect that the "highest_iteration" check is not needed
> at all after the iteration mechanism was cleaned up last week.
>
> Could you please test whether this test-patch causes any problems?
> If it doesn't then I think we can just get rid of highest_iteration.

No problems, it looks like "highest_iteration" is not needed.
Loading...