Mercurial > hg > octave-lojdl
changeset 10226:2884758e265b
Replace dataaspectratio props with plotboxaspectratio props.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Fri, 29 Jan 2010 21:52:53 -0500 |
parents | 477d05b0a739 |
children | d3fc22c3071c |
files | scripts/ChangeLog scripts/plot/__go_draw_axes__.m scripts/plot/axis.m scripts/plot/colorbar.m scripts/plot/isocolors.m scripts/plot/isonormals.m scripts/plot/isosurface.m scripts/plot/plotyy.m scripts/plot/polar.m scripts/plot/private/__actual_axis_position__.m scripts/plot/surfl.m |
diffstat | 11 files changed, 45 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,12 @@ +2010-01-29 Ben Abbott <bpabbott@mac.com> + + * plot/axis.m, plot/__go_draw_axes__.m, plot/colorbar.m, + plot/isocolors.m, plot/isonormals.m, plot/isosurface.m, + plot/plotyy.m, plot/polar.m, plot/surfl.m, + plot/private/__actual_axis_position.m: + Replace dataaspectratio and dataaspectratiomode properties with + plotboxaspectratio and plotboxaspectratio properties. + 2010-01-29 John W. Eaton <jwe@octave.org> * polynomial/compan.m, polynomial/conv.m, polynomial/deconv.m,
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -49,7 +49,7 @@ pos = axis_obj.position; pos = pos - implicit_margin([1, 2, 1, 2]).*[1, 1, -0.5, -0.5]; if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin")) - if (strcmpi (axis_obj.dataaspectratiomode, "manual")) + if (strcmpi (axis_obj.plotboxaspectratiomode, "manual")) pos = __actual_axis_position__ (axis_obj); endif if (nd == 2) @@ -72,8 +72,8 @@ fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2)); fprintf (plot_stream, "set size %.15g, %.15g;\n", pos(3), pos(4)); - if (strcmpi (axis_obj.dataaspectratiomode, "manual")) - r = axis_obj.dataaspectratio; + if (strcmpi (axis_obj.plotboxaspectratiomode, "manual")) + r = axis_obj.plotboxaspectratio; fprintf (plot_stream, "set size ratio %.15g;\n", -r(2)/r(1)); else fputs (plot_stream, "set size noratio;\n");
--- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -165,22 +165,22 @@ __do_tight_option__ (ca); elseif (strcmpi (ax, "square")) if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin")) - set (ca, "dataaspectratio", [1, 1, 1]); + set (ca, "plotboxaspectratio", [1, 1, 1]); else x = xlim; y = ylim; - set (ca, "dataaspectratio", [(y(2)-y(1)), (x(2)-x(1)), 1]); + set (ca, "plotboxaspectratio", [(y(2)-y(1)), (x(2)-x(1)), 1]); endif elseif (strcmp (ax, "equal")) if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin")) x = xlim; y = ylim; - set (ca, "dataaspectratio", [(x(2)-x(1)), (y(2)-y(1)), 1]); + set (ca, "plotboxaspectratio", [(x(2)-x(1)), (y(2)-y(1)), 1]); else - set (ca, "dataaspectratio", [1, 1, 1]); + set (ca, "plotboxaspectratio", [1, 1, 1]); endif elseif (strcmpi (ax, "normal")) - set (ca, "dataaspectratiomode", "auto"); + set (ca, "plotboxaspectratiomode", "auto"); ## axis limits elseif (len >= 4 && strcmpi (ax(1:4), "auto"))
--- a/scripts/plot/colorbar.m +++ b/scripts/plot/colorbar.m @@ -146,7 +146,7 @@ endif if (! isnan (aspect)) - set (cax, "dataaspectratio", aspect); + set (cax, "plotboxaspectratio", aspect); endif ctext = text (0, 0, "", "tag", "colorbar","visible", "off", @@ -157,7 +157,7 @@ set (cax, "deletefcn", {@resetaxis, orig_pos, orig_opos}); addlistener (ax, "clim", {@update_colorbar_clim, hi, vertical}) - addlistener (ax, "dataaspectratio", {@update_colorbar_axis, cax}) + addlistener (ax, "plotboxaspectratio", {@update_colorbar_axis, cax}) addlistener (ax, "position", {@update_colorbar_axis, cax}) endif @@ -236,7 +236,7 @@ endif if (! isnan (aspect)) - set (cax, "dataaspectratio", aspect); + set (cax, "plotboxaspectratio", aspect); endif endif endfunction @@ -247,8 +247,8 @@ sz = pos(3:4); off = 0; - if (strcmpi (obj.dataaspectratiomode, "manual")) - r = obj.dataaspectratio; + if (strcmpi (obj.plotboxaspectratiomode, "manual")) + r = obj.plotboxaspectratio; if (pos(3) > pos(4)) switch (cbox) case {"east", "eastoutside", "west", "westoutside"} @@ -324,7 +324,7 @@ cpos = [origin, sz]; - if (strcmpi (obj.dataaspectratiomode, "manual")) + if (strcmpi (obj.plotboxaspectratiomode, "manual")) if (__gnuplot_has_feature__ ("screen_coordinates_for_{lrtb}margin")) obj.position = pos; actual_pos = __actual_axis_position__ (obj);
--- a/scripts/plot/isocolors.m +++ b/scripts/plot/isocolors.m @@ -46,8 +46,8 @@ ## For example, ## @example ## function [] = isofinish (p) -## set (gca, "DataAspectRatioMode", "manual", \ -## "DataAspectRatio", [1 1 1]); +## set (gca, "PlotBoxAspectRatioMode", "manual", \ +## "PlotBoxAspectRatio", [1 1 1]); ## set (p, "FaceColor", "interp"); ## ## set (p, "FaceLighting", "flat"); ## ## light ("Position", [1 1 5]); ## Available with JHandles
--- a/scripts/plot/isonormals.m +++ b/scripts/plot/isonormals.m @@ -44,7 +44,7 @@ ## For example, ## @example ## function [] = isofinish (p) -## set (gca, "DataAspectRatioMode","manual","DataAspectRatio",[1 1 1]); +## set (gca, "PlotBoxAspectRatioMode","manual","PlotBoxAspectRatio",[1 1 1]); ## set (p, "VertexNormals", -get(p,"VertexNormals")); ## Revert normals ## set (p, "FaceColor", "interp"); ## ## set (p, "FaceLighting", "phong");
--- a/scripts/plot/isosurface.m +++ b/scripts/plot/isosurface.m @@ -78,13 +78,13 @@ ## subplot (2, 2, 1); view (-38, 20); ## [f, v] = isosurface (x, y, z, c, iso); ## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); -## set (gca, "DataAspectRatioMode","manual", "DataAspectRatio", [1 1 1]); +## set (gca, "PlotBoxAspectRatioMode","manual", "PlotBoxAspectRatio", [1 1 1]); ## # set (p, "FaceColor", "green", "FaceLighting", "phong"); ## # light ("Position", [1 1 5]); ## Available with the JHandles package ## ## subplot (2, 2, 2); view (-38, 20); ## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "blue"); -## set (gca, "DataAspectRatioMode","manual", "DataAspectRatio", [1 1 1]); +## set (gca, "PlotBoxAspectRatioMode","manual", "PlotBoxAspectRatio", [1 1 1]); ## # set (p, "FaceColor", "none", "FaceLighting", "phong"); ## # light ("Position", [1 1 5]); ## @@ -92,14 +92,14 @@ ## [f, v, c] = isosurface (x, y, z, c, iso, y); ## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, \ ## "FaceColor", "interp", "EdgeColor", "none"); -## set (gca, "DataAspectRatioMode","manual", "DataAspectRatio", [1 1 1]); +## set (gca, "PlotBoxAspectRatioMode","manual", "PlotBoxAspectRatio", [1 1 1]); ## # set (p, "FaceLighting", "phong"); ## # light ("Position", [1 1 5]); ## ## subplot (2, 2, 4); view (-38, 20); ## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, \ ## "FaceColor", "interp", "EdgeColor", "blue"); -## set (gca, "DataAspectRatioMode","manual", "DataAspectRatio", [1 1 1]); +## set (gca, "PlotBoxAspectRatioMode","manual", "PlotBoxAspectRatio", [1 1 1]); ## # set (p, "FaceLighting", "phong"); ## # light ("Position", [1 1 5]); ## @end example
--- a/scripts/plot/plotyy.m +++ b/scripts/plot/plotyy.m @@ -183,8 +183,8 @@ addlistener (ax(2), "position", {@update_position, ax(1)}); addlistener (ax(1), "view", {@update_position, ax(2)}); addlistener (ax(2), "view", {@update_position, ax(1)}); - addlistener (ax(1), "dataaspectratio", {@update_position, ax(2)}); - addlistener (ax(2), "dataaspectratio", {@update_position, ax(1)}); + addlistener (ax(1), "plotboxaspectratio", {@update_position, ax(2)}); + addlistener (ax(2), "plotboxaspectratio", {@update_position, ax(1)}); ## Tag the plotyy axes, so we can use that information ## not to mirror the y axis tick marks @@ -237,19 +237,19 @@ recursion = true; position = get (h, "position"); view = get (h, "view"); - dataaspectratio = get (h, "dataaspectratio"); - dataaspectratiomode = get (h, "dataaspectratiomode"); + plotboxaspectratio = get (h, "plotboxaspectratio"); + plotboxaspectratiomode = get (h, "plotboxaspectratiomode"); oldposition = get (ax2, "position"); oldview = get (ax2, "view"); - olddataaspectratio = get (ax2, "dataaspectratio"); - olddataaspectratiomode = get (ax2, "dataaspectratiomode"); + oldplotboxaspectratio = get (ax2, "plotboxaspectratio"); + oldplotboxaspectratiomode = get (ax2, "plotboxaspectratiomode"); if (! (isequal (position, oldposition) && isequal (view, oldview))) set (ax2, "position", position, "view", view) endif - if (! (isequal (dataaspectratio, olddataaspectratio) - && isequal (dataaspectratiomode, olddataaspectratiomode))) - set (ax2, "dataaspectratio", dataaspectratio); - set (ax2, "dataaspectratiomode", dataaspectratiomode); + if (! (isequal (plotboxaspectratio, oldplotboxaspectratio) + && isequal (plotboxaspectratiomode, oldplotboxaspectratiomode))) + set (ax2, "plotboxaspectratio", plotboxaspectratio); + set (ax2, "plotboxaspectratiomode", plotboxaspectratiomode); endif unwind_protect_cleanup recursion = false;
--- a/scripts/plot/polar.m +++ b/scripts/plot/polar.m @@ -70,7 +70,7 @@ set (h, "xlim", [-maxr, maxr], "ylim", [-maxr, maxr], "xaxislocation", "zero", "yaxislocation", "zero", - "dataaspectratio", [1, 1, 1]); + "plotboxaspectratio", [1, 1, 1]); if (nargout > 0) retval = tmp;
--- a/scripts/plot/private/__actual_axis_position__.m +++ b/scripts/plot/private/__actual_axis_position__.m @@ -34,10 +34,10 @@ if (__calc_dimensions__ (axis_obj) == 3) ## FIXME -- this works for "axis square", but has not been ## thoroughly tested for other aspect ratios. - aspect_ratio_2d = [max(axis_obj.dataaspectratio(1:2)), ... - axis_obj.dataaspectratio(3)/sqrt(2)]; + aspect_ratio_2d = [max(axis_obj.plotboxaspectratio(1:2)), ... + axis_obj.plotboxaspectratio(3)/sqrt(2)]; else - aspect_ratio_2d = axis_obj.dataaspectratio(1:2); + aspect_ratio_2d = axis_obj.plotboxaspectratio(1:2); endif orig_fig_units = get (axis_obj.parent, "units"); orig_fig_position = get (axis_obj.parent, "units");