comparison scripts/plot/gnuplot_drawnow.m @ 8813:70d06ed27c08

gnuplot_drawnow.m: Only send figure position info to gnuplot when the plot stream is first opened. Revert usage of hidden axes to store prior figure "position" property.
author Ben Abbott <bpabbott@mac.com>
date Thu, 19 Feb 2009 07:34:15 -0500
parents 4c989d52f35c
children 665b264b6a50
comparison
equal deleted inserted replaced
8812:7d48766c21a5 8813:70d06ed27c08
56 endif 56 endif
57 end_unwind_protect 57 end_unwind_protect
58 elseif (nargin == 1) 58 elseif (nargin == 1)
59 ## Graphics terminal for display. 59 ## Graphics terminal for display.
60 plot_stream = get (h, "__plot_stream__"); 60 plot_stream = get (h, "__plot_stream__");
61 tag = "gnuplot_drawnow";
62 if (isempty (plot_stream)) 61 if (isempty (plot_stream))
63 plot_stream = open_gnuplot_stream (2, h); 62 plot_stream = open_gnuplot_stream (2, h);
64 new_stream = true; 63 new_stream = true;
65 ha = axes ("tag", tag, "visible", "off");
66 set (ha, "userdata", get (h, "position"));
67 else 64 else
68 new_stream = false; 65 new_stream = false;
69 unwind_protect
70 set (0, "showhiddenhandles", "on");
71 ha = findobj (h, "type", "axes", "tag", tag);
72 position = get (h, "position");
73 if (! isempty (ha))
74 prior_position = get (ha, "userdata");
75 if (! all (position == prior_position))
76 new_stream = true;
77 else
78 ## FIXME -- Obtain the x11 window id from gnuplot and
79 ## determine the current position via xwininfo. The
80 ## "position" property may then be updated to reflect
81 ## changes in window position/size made by the mouse.
82 endif
83 else
84 ha = axes ("tag", tag, "visible", "off");
85 endif
86 set (ha, "userdata", position);
87 unwind_protect_cleanup
88 set (0, "showhiddenhandles", "off");
89 end_unwind_protect
90 endif 66 endif
91 enhanced = gnuplot_set_term (plot_stream (1), new_stream, h); 67 enhanced = gnuplot_set_term (plot_stream (1), new_stream, h);
92 __go_draw_figure__ (h, plot_stream (1), enhanced, mono); 68 __go_draw_figure__ (h, plot_stream (1), enhanced, mono);
93 fflush (plot_stream (1)); 69 fflush (plot_stream (1));
94 else 70 else