# HG changeset patch # User Rik # Date 1685491492 25200 # Node ID 10daf5ce7f28f23f4783d4fee1773d127fce65f2 # Parent d039fbf922971f1fe558ca58d19092c017d04b57 Set "tight" axes limits by default for pcolor() plot (bug #64244) * NEWS.9.md: Announce change in Matlab Compatibility section. * pcolor.m: Set axes properties "[xyz]limitmethod" to "tight" so that plot just encompasses the given data. diff -r d039fbf92297 -r 10daf5ce7f28 etc/NEWS.9.md --- a/etc/NEWS.9.md Mon May 22 16:22:42 2023 -0700 +++ b/etc/NEWS.9.md Tue May 30 17:04:52 2023 -0700 @@ -93,6 +93,9 @@ of the generalized eigenvalues has been removed (one can use the `ordqz` function for that purpose). +- `pcolor` now sets the axes limits to be just large enough to display the +plotted data (equivalent of `axis tight`). + ### Alphabetical list of new functions added in Octave 9 * `isuniform` diff -r d039fbf92297 -r 10daf5ce7f28 scripts/plot/draw/pcolor.m --- a/scripts/plot/draw/pcolor.m Mon May 22 16:22:42 2023 -0700 +++ b/scripts/plot/draw/pcolor.m Tue May 30 17:04:52 2023 -0700 @@ -91,44 +91,9 @@ set (htmp, "facecolor", "flat"); if (! ishold ()) set (hax, "view", [0, 90], "box", "on"); - ## FIXME: Maybe this should be in the general axis limit setting routine? - ## When values are integers (such as from meshgrid), we want to - ## use tight limits for pcolor, mesh, surf, etc. Situation is - ## complicated immensely by vector or matrix input and meshgrid() - ## or ndgrid() format. - meshgrid_fmt = true; - if (isvector (x)) - xrng = x(isfinite (x)); - else - xrng = x(1, isfinite (x(1,:))); # meshgrid format (default) - if (all (xrng == xrng(1))) - xrng = x(isfinite (x(:,1)), 1); # ndgrid format - meshgrid_fmt = false; - endif - endif - if (isvector (y)) - yrng = y(isfinite (y)); - else - if (meshgrid_fmt) - yrng = y(isfinite (y(:,1)), 1); - else - yrng = y(1, isfinite (y(1,:))); - endif - endif - if (all (xrng == fix (xrng))) - xmin = min (xrng); - xmax = max (xrng); - if (xmin < xmax) - xlim ([xmin, xmax]); - endif - endif - if (all (yrng == fix (yrng))) - ymin = min (yrng); - ymax = max (yrng); - if (ymin < ymax) - ylim ([ymin, ymax]); - endif - endif + set (hax, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto", + "xlimitmethod", "tight", "ylimitmethod", "tight", + "zlimitmethod", "tight"); endif unwind_protect_cleanup