changeset 9055:8651fcc89556

gnuplot_drawnow.m: Always set figure property "__plot_stream__" to the active gnuplot steam.
author Ben Abbott <bpabbott@mac.com>
date Sat, 28 Mar 2009 20:49:50 -0400
parents 0735e427c6c0
children b06dc393ac42
files scripts/ChangeLog scripts/plot/gnuplot_drawnow.m
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-28  Ben Abbott <bpabbott@mac.com>
+
+	* plot/gnuplot_drawnow.m: Always set figure property "__plot_stream__"
+	to the active gnuplot steam. Permits __gnuplot_get_var__ to return to
+	proper result for all gnuplot streams.
+
 2009-03-27  Ben Abbott <bpabbott@mac.com>
 
 	* plot/__go_draw_axes__.m: Properly position the title for 3D plots
--- a/scripts/plot/gnuplot_drawnow.m
+++ b/scripts/plot/gnuplot_drawnow.m
@@ -39,8 +39,10 @@
     plot_stream = [];
     fid = [];
     printing = ! output_to_screen (gnuplot_trim_term (term));
+    default_plot_stream = get (h, "__plot_stream__");
     unwind_protect
       plot_stream = open_gnuplot_stream (2, []);
+      set (h, "__plot_stream__", plot_stream);
       if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS"))
         available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS");
         available_terminals = regexp (available_terminals, "\\b\\w+\\b", "match");
@@ -63,6 +65,7 @@
                gnuplot_trim_term (term))
       endif
     unwind_protect_cleanup
+      set (h, "__plot_stream__", default_plot_stream);
       if (! isempty (plot_stream))
         pclose (plot_stream(1));
         if (numel (plot_stream) == 2)