comparison scripts/plot/__gnuplot_drawnow__.m @ 14417:12d13534265c

Add support for figure positioning for gnuplot Windows terminals. * __gnuplot_drawnow__.m: Support postion and size options for Windows term. * __gnuplot_has_feature__.m: As of gnuplot-4.4.0 the Windows terminal accepts the position and size options.
author Ben Abbott <bpabbott@mac.com>
date Tue, 28 Feb 2012 07:42:40 -0500
parents f3d52523cde1
children 80e8c03548a4 86854d032a37
comparison
equal deleted inserted replaced
14416:59e20a5e2ca8 14417:12d13534265c
195 if (all (gnuplot_size > 0)) 195 if (all (gnuplot_size > 0))
196 terminals_with_size = {"canvas", "emf", "epslatex", "fig", ... 196 terminals_with_size = {"canvas", "emf", "epslatex", "fig", ...
197 "gif", "jpeg", "latex", "pbm", "pdf", ... 197 "gif", "jpeg", "latex", "pbm", "pdf", ...
198 "pdfcairo", "postscript", "png", "pngcairo", ... 198 "pdfcairo", "postscript", "png", "pngcairo", ...
199 "pstex", "pslatex", "svg", "tikz"}; 199 "pstex", "pslatex", "svg", "tikz"};
200 if (__gnuplot_has_feature__ ("windows_figure_position"))
201 terminals_with_size{end+1} = "windows";
202 endif
200 if (__gnuplot_has_feature__ ("x11_figure_position")) 203 if (__gnuplot_has_feature__ ("x11_figure_position"))
201 terminals_with_size{end+1} = "x11"; 204 terminals_with_size{end+1} = "x11";
202 endif 205 endif
203 if (__gnuplot_has_feature__ ("wxt_figure_size")) 206 if (__gnuplot_has_feature__ ("wxt_figure_size"))
204 terminals_with_size{end+1} = "wxt"; 207 terminals_with_size{end+1} = "wxt";
224 case "dxf" 227 case "dxf"
225 size_str = ""; 228 size_str = "";
226 otherwise 229 otherwise
227 size_str = ""; 230 size_str = "";
228 endswitch 231 endswitch
229 if (strncmpi (term, "x11", 3) 232 if ((strncmpi (term, "x11", 3)
230 && __gnuplot_has_feature__ ("x11_figure_position")) 233 && __gnuplot_has_feature__ ("x11_figure_position"))
231 ## X11 allows the window to be positioned as well. 234 || (strcmpi (term, "windows")
235 && __gnuplot_has_feature__ ("windows_figure_position")))
236 ## X11/Windows allows the window to be positioned as well.
232 units = get (0, "units"); 237 units = get (0, "units");
233 unwind_protect 238 unwind_protect
234 set (0, "units", "pixels"); 239 set (0, "units", "pixels");
235 screen_size = get (0, "screensize")(3:4); 240 screen_size = get (0, "screensize")(3:4);
236 unwind_protect_cleanup 241 unwind_protect_cleanup
237 set (0, "units", units); 242 set (0, "units", units);
238 end_unwind_protect 243 end_unwind_protect
239 if (all (screen_size > 0)) 244 if (all (screen_size > 0))
240 ## For X11, set the figure positon as well as the size 245 ## For X11/Windows, set the figure positon as well as the size
241 ## gnuplot position is UL, Octave's is LL (same for screen/window) 246 ## gnuplot position is UL, Octave's is LL (same for screen/window)
242 gnuplot_pos(2) = screen_size(2) - gnuplot_pos(2) - gnuplot_size(2); 247 gnuplot_pos(2) = screen_size(2) - gnuplot_pos(2) - gnuplot_size(2);
243 gnuplot_pos = max (gnuplot_pos, 1); 248 gnuplot_pos = max (gnuplot_pos, 1);
244 size_str = sprintf ("%s position %d,%d", size_str, 249 size_str = sprintf ("%s position %d,%d", size_str,
245 gnuplot_pos(1), gnuplot_pos(2)); 250 gnuplot_pos(1), gnuplot_pos(2));