scripts/plot/gnuplot_drawnow.m
changeset 9395 54a3fa5d4376
parent 9367 a7dbfd45c2aa
child 9416 7ed8182b783d
     1.1 --- a/scripts/plot/gnuplot_drawnow.m	Fri Jun 26 12:56:16 2009 +0200
     1.2 +++ b/scripts/plot/gnuplot_drawnow.m	Thu Aug 06 07:30:34 2009 +0200
     1.3 @@ -266,43 +266,50 @@
     1.4        size_str = "";
     1.5      endif
     1.6  
     1.7 -    ## Set the gnuplot terminal (type, enhanced?, title, & size).
     1.8 -    if (! isempty (term))
     1.9 -      term_str = sprintf ("set terminal %s", term);
    1.10 -      if (any (strncmpi (term, {"x11", "wxt"}, 3)) && new_stream
    1.11 -	  && __gnuplot_has_feature__ ("x11_figure_position"))
    1.12 -        ## The "close" is added to allow the figure position property
    1.13 -        ## to remain active.
    1.14 -        term_str = sprintf ("%s close", term_str);
    1.15 +    ## Set the gnuplot terminal (type, enhanced, title, options & size).
    1.16 +    term_str = sprintf ("set terminal %s", term);
    1.17 +    if (! isempty (enh_str))
    1.18 +      term_str = sprintf ("%s %s", term_str, enh_str);
    1.19 +    endif
    1.20 +    if (! isempty (title_str))
    1.21 +      term_str = sprintf ("%s %s", term_str, title_str);
    1.22 +    endif
    1.23 +    if (nargin > 3 && ischar (opts_str))
    1.24 +      ## Options must go last.
    1.25 +      term_str = sprintf ("%s %s", term_str, opts_str);
    1.26 +    endif
    1.27 +    if (! isempty (size_str) && new_stream)
    1.28 +      ## size_str comes after other options to permit specification of
    1.29 +      ## the canvas size for terminals cdr/corel.
    1.30 +      term_str = sprintf ("%s %s", term_str, size_str);
    1.31 +    endif
    1.32 +    ## Work around the gnuplot feature of growing the x11 window when
    1.33 +    ## the mouse and multiplot are set.
    1.34 +    fputs (plot_stream, "unset multiplot;\n");
    1.35 +    if (! strcmp (term, "x11")
    1.36 +        || numel (findall (h, "type", "axes")) > 1
    1.37 +        || numel (findall (h, "type", "image")) > 0)
    1.38 +      fprintf (plot_stream, "%s\n", term_str);
    1.39 +      if (nargin == 5)
    1.40 +        if (! isempty (file))
    1.41 +          fprintf (plot_stream, "set output '%s';\n", file);
    1.42 +        endif
    1.43        endif
    1.44 -      if (! isempty (enh_str))
    1.45 -        term_str = sprintf ("%s %s", term_str, enh_str);
    1.46 +      fputs (plot_stream, "set multiplot;\n");
    1.47 +    elseif (strcmp (term, "x11"))
    1.48 +      fprintf (plot_stream, "%s\n", term_str);
    1.49 +      if (nargin == 5)
    1.50 +        if (! isempty (file))
    1.51 +          fprintf (plot_stream, "set output '%s';\n", file);
    1.52 +        endif
    1.53        endif
    1.54 -      if (! isempty (title_str))
    1.55 -        term_str = sprintf ("%s %s", term_str, title_str);
    1.56 -      endif
    1.57 -      if (nargin > 3 && ischar (opts_str))
    1.58 -        ## Options must go last.
    1.59 -        term_str = sprintf ("%s %s", term_str, opts_str);
    1.60 -      endif
    1.61 -      if (! isempty (size_str) && new_stream)
    1.62 -        ## size_str goes last to permit specification of canvas size
    1.63 -        ## for terminals cdr/corel.
    1.64 -        term_str = sprintf ("%s %s", term_str, size_str);
    1.65 -      endif
    1.66 -      fprintf (plot_stream, "%s\n", term_str);
    1.67 -    else
    1.68 -      ## gnuplot will pick up the GNUTERM environment variable itself
    1.69 -      ## so no need to set the terminal type if not also setting the
    1.70 -      ## figure title, enhanced mode, or position.
    1.71      endif
    1.72 +  else
    1.73 +    ## gnuplot will pick up the GNUTERM environment variable itself
    1.74 +    ## so no need to set the terminal type if not also setting the
    1.75 +    ## figure title, enhanced mode, or position.
    1.76    endif
    1.77  
    1.78 -  if (nargin == 5)
    1.79 -    if (! isempty (file))
    1.80 -      fprintf (plot_stream, "set output '%s';\n", file);
    1.81 -    endif
    1.82 -  endif
    1.83  
    1.84  endfunction
    1.85