Mercurial > octave-nkf
diff scripts/plot/__go_draw_axes__.m @ 11001:2ab8cc6dcced
Special treatment activepositionproperty = outerposition for gnuplot.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 19 Sep 2010 20:47:46 -0400 |
parents | 65c14c052fe3 |
children | c9b0a75b02e8 |
line wrap: on
line diff
--- a/scripts/plot/__go_draw_axes__.m Sun Sep 19 20:26:18 2010 -0400 +++ b/scripts/plot/__go_draw_axes__.m Sun Sep 19 20:47:46 2010 -0400 @@ -82,42 +82,53 @@ dr = 1; endif - if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin")) - if (nd == 2 || all (mod (axis_obj.view, 90) == 0)) - x = [1, 1]; + if (strcmp (axis_obj.activepositionproperty, "position")) + if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin")) + if (nd == 2 || all (mod (axis_obj.view, 90) == 0)) + x = [1, 1]; + else + ## 3D plots need to be sized down to fit in the window. + x = 1.0 ./ sqrt([2, 2.5]); + endif + fprintf (plot_stream, "set tmargin screen %.15g;\n", + pos(2)+pos(4)/2+x(2)*pos(4)/2); + fprintf (plot_stream, "set bmargin screen %.15g;\n", + pos(2)+pos(4)/2-x(2)*pos(4)/2); + fprintf (plot_stream, "set lmargin screen %.15g;\n", + pos(1)+pos(3)/2-x(1)*pos(3)/2); + fprintf (plot_stream, "set rmargin screen %.15g;\n", + pos(1)+pos(3)/2+x(1)*pos(3)/2); + sz_str = ""; else - ## 3D plots need to be sized down to fit in the window. - x = 1.0 ./ sqrt([2, 2.5]); + fprintf (plot_stream, "set tmargin 0;\n"); + fprintf (plot_stream, "set bmargin 0;\n"); + fprintf (plot_stream, "set lmargin 0;\n"); + fprintf (plot_stream, "set rmargin 0;\n"); + + if (nd == 3 && all (axis_obj.view == [0, 90])) + ## FIXME -- Kludge to allow colorbar to be added to a pcolor() plot + pos(3:4) = pos(3:4) * 1.4; + pos(1:2) = pos(1:2) - pos(3:4) * 0.125; + endif + + fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2)); + + if (strcmpi (axis_obj.dataaspectratiomode, "manual")) + sz_str = sprintf ("set size ratio %.15g", -dr); + else + sz_str = "set size noratio"; + endif + sz_str = sprintf ("%s %.15g, %.15g;\n", sz_str, pos(3), pos(4)); endif - fprintf (plot_stream, "set tmargin screen %.15g;\n", - pos(2)+pos(4)/2+x(2)*pos(4)/2); - fprintf (plot_stream, "set bmargin screen %.15g;\n", - pos(2)+pos(4)/2-x(2)*pos(4)/2); - fprintf (plot_stream, "set lmargin screen %.15g;\n", - pos(1)+pos(3)/2-x(1)*pos(3)/2); - fprintf (plot_stream, "set rmargin screen %.15g;\n", - pos(1)+pos(3)/2+x(1)*pos(3)/2); + else ## activepositionproperty == outerposition + fprintf (plot_stream, "set origin %g, %g;\n", pos(1:2)) sz_str = ""; - else - fprintf (plot_stream, "set tmargin 0;\n"); - fprintf (plot_stream, "set bmargin 0;\n"); - fprintf (plot_stream, "set lmargin 0;\n"); - fprintf (plot_stream, "set rmargin 0;\n"); - - if (nd == 3 && all (axis_obj.view == [0, 90])) - ## FIXME -- Kludge to allow colorbar to be added to a pcolor() plot - pos(3:4) = pos(3:4) * 1.4; - pos(1:2) = pos(1:2) - pos(3:4) * 0.125; + if (strcmpi (axis_obj.dataaspectratiomode, "manual")) + sz_str = sprintf ("ratio %g", -dr); + else + sz_str = "noratio"; endif - - fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2)); - - if (strcmpi (axis_obj.dataaspectratiomode, "manual")) - sz_str = sprintf ("set size ratio %.15g", -dr); - else - sz_str = "set size noratio"; - endif - sz_str = sprintf ("%s %.15g, %.15g;\n", sz_str, pos(3), pos(4)); + sz_str = sprintf ("set size %s %g, %g;\n", sz_str, pos(3:4)); endif if (! isempty (sz_str)) fputs (plot_stream, sz_str);