Mercurial > hg > octave-jordi
changeset 18587:5032ac119d52
Make xlim, ylim and zlim accept special values Inf/-Inf (bug #41933).
* __axis_limits__.m: use autoscale limit when Inf value is met.
* axis.m: Replace limit setting code with xlim, ylim, and zlim commands.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Sun, 23 Mar 2014 12:41:15 +0100 |
parents | 5cf9a02732b6 |
children | 35a5e7740a6d |
files | scripts/plot/appearance/axis.m scripts/plot/appearance/private/__axis_limits__.m |
diffstat | 2 files changed, 8 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/appearance/axis.m +++ b/scripts/plot/appearance/axis.m @@ -298,36 +298,16 @@ endif endfor - autoscale = isinf (ax); - lims = []; if (len > 1) - if (any (autoscale(1:2))) - set (ca, "xlimmode", "auto"); - lims = ax(1:2); - lims(autoscale(1:2)) = get (ca, "xlim")(autoscale(1:2)); - ax(1:2) = lims; - endif - set (ca, "xlim", [ax(1), ax(2)]); + xlim (ax(1:2)); endif if (len > 3) - if (any (autoscale(3:4))) - set (ca, "ylimmode", "auto"); - lims = ax(3:4); - lims(autoscale(3:4)) = get (ca, "ylim")(autoscale(3:4)); - ax(3:4) = lims; - endif - set (ca, "ylim", [ax(3), ax(4)]); + ylim (ax(3:4)); endif if (len > 5) - if (any (autoscale(5:6))) - set (ca, "zlimmode", "auto"); - lims = ax(5:6); - lims(autoscale(5:6)) = get (ca, "zlim")(autoscale(5:6)); - ax(5:6) = lims; - endif - set (ca, "zlim", [ax(5), ax(6)]); + zlim (ax(5:6)); endif else
--- a/scripts/plot/appearance/private/__axis_limits__.m +++ b/scripts/plot/appearance/private/__axis_limits__.m @@ -48,6 +48,11 @@ if (arg(1) >= arg(2)) error ("%s: axis limits must be increasing", fcn); else + autoscale = isinf (arg); + if (any (autoscale)) + set (hax, fcnmode, "auto"); + arg(autoscale) = get (hax, fcn)(autoscale); + endif set (hax, fcn, arg(:)); endif endif