Mercurial > octave-dspies
comparison scripts/plot/appearance/axis.m @ 18588: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 | 89a8a90ac850 |
children | cf3db95a75f0 |
comparison
equal
deleted
inserted
replaced
18587:5cf9a02732b6 | 18588:5032ac119d52 |
---|---|
296 if (ax(i) >= ax(i+1)) | 296 if (ax(i) >= ax(i+1)) |
297 error ("axis: limits(%d) must be less than limits(%d)", i, i+1); | 297 error ("axis: limits(%d) must be less than limits(%d)", i, i+1); |
298 endif | 298 endif |
299 endfor | 299 endfor |
300 | 300 |
301 autoscale = isinf (ax); | |
302 lims = []; | |
303 if (len > 1) | 301 if (len > 1) |
304 if (any (autoscale(1:2))) | 302 xlim (ax(1:2)); |
305 set (ca, "xlimmode", "auto"); | |
306 lims = ax(1:2); | |
307 lims(autoscale(1:2)) = get (ca, "xlim")(autoscale(1:2)); | |
308 ax(1:2) = lims; | |
309 endif | |
310 set (ca, "xlim", [ax(1), ax(2)]); | |
311 endif | 303 endif |
312 | 304 |
313 if (len > 3) | 305 if (len > 3) |
314 if (any (autoscale(3:4))) | 306 ylim (ax(3:4)); |
315 set (ca, "ylimmode", "auto"); | |
316 lims = ax(3:4); | |
317 lims(autoscale(3:4)) = get (ca, "ylim")(autoscale(3:4)); | |
318 ax(3:4) = lims; | |
319 endif | |
320 set (ca, "ylim", [ax(3), ax(4)]); | |
321 endif | 307 endif |
322 | 308 |
323 if (len > 5) | 309 if (len > 5) |
324 if (any (autoscale(5:6))) | 310 zlim (ax(5:6)); |
325 set (ca, "zlimmode", "auto"); | |
326 lims = ax(5:6); | |
327 lims(autoscale(5:6)) = get (ca, "zlim")(autoscale(5:6)); | |
328 ax(5:6) = lims; | |
329 endif | |
330 set (ca, "zlim", [ax(5), ax(6)]); | |
331 endif | 311 endif |
332 | 312 |
333 else | 313 else |
334 error ("axis: expecting no args, or a vector with 2, 4, or 6 elements"); | 314 error ("axis: expecting no args, or a vector with 2, 4, or 6 elements"); |
335 endif | 315 endif |