|
From: Ethan A M. <sf...@us...> - 2016-10-26 18:44:53
|
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
|