|
From: thse <t.s...@fz...> - 2016-10-26 15:21:04
|
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;
}
--
View this message in context: http://gnuplot.10905.n7.nabble.com/several-iterations-in-one-plot-result-in-sometimes-missing-overwritten-plots-tp20412.html
Sent from the Gnuplot - Dev mailing list archive at Nabble.com.
|
|
From: thse <t.s...@fz...> - 2016-10-26 18:27:27
|
I uploaded the patch to sourceforge. -- View this message in context: http://gnuplot.10905.n7.nabble.com/several-iterations-in-one-plot-result-in-sometimes-missing-overwritten-plots-tp20412p20413.html Sent from the Gnuplot - Dev mailing list archive at Nabble.com. |
|
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
|
|
From: thse <t.s...@fz...> - 2016-10-27 09:24:11
|
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. -- View this message in context: http://gnuplot.10905.n7.nabble.com/several-iterations-in-one-plot-result-in-sometimes-missing-overwritten-plots-tp20412p20415.html Sent from the Gnuplot - Dev mailing list archive at Nabble.com. |