# HG changeset patch # User Ben Abbott # Date 1264819973 18000 # Node ID 2884758e265bc9c56f10fe9bc8392d530aa3f48e # Parent 477d05b0a73948c964fc5568638cc4b24e6c07c8 Replace dataaspectratio props with plotboxaspectratio props. diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,12 @@ +2010-01-29 Ben Abbott + + * 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 * polynomial/compan.m, polynomial/conv.m, polynomial/deconv.m, diff --git a/scripts/plot/__go_draw_axes__.m b/scripts/plot/__go_draw_axes__.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"); diff --git a/scripts/plot/axis.m b/scripts/plot/axis.m --- 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")) diff --git a/scripts/plot/colorbar.m b/scripts/plot/colorbar.m --- 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); diff --git a/scripts/plot/isocolors.m b/scripts/plot/isocolors.m --- 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 diff --git a/scripts/plot/isonormals.m b/scripts/plot/isonormals.m --- 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"); diff --git a/scripts/plot/isosurface.m b/scripts/plot/isosurface.m --- 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 diff --git a/scripts/plot/plotyy.m b/scripts/plot/plotyy.m --- 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; diff --git a/scripts/plot/polar.m b/scripts/plot/polar.m --- 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; diff --git a/scripts/plot/private/__actual_axis_position__.m b/scripts/plot/private/__actual_axis_position__.m --- 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"); diff --git a/scripts/plot/surfl.m b/scripts/plot/surfl.m --- a/scripts/plot/surfl.m +++ b/scripts/plot/surfl.m @@ -138,7 +138,7 @@ endif vn = get (tmp, "vertexnormals"); - dar = get (h, "dataaspectratio"); + dar = get (h, "plotboxaspectratio"); vn(:,:,1) *= dar(1); vn(:,:,2) *= dar(2); vn(:,:,3) *= dar(3);