Mercurial > hg > octave-nkf
comparison scripts/plot/axis.m @ 14063:6875d23ce051 stable
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
* axis.m: Fix regression of tight axis limits introduced by
changeset ec79cd8359c5. Add test.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Fri, 16 Dec 2011 07:59:58 -0500 |
parents | ec79cd8359c5 |
children | 22c50cbad2ce |
comparison
equal
deleted
inserted
replaced
14062:5b49cafe0599 | 14063:6875d23ce051 |
---|---|
321 scale = get (ca, strcat (ax, "scale")); | 321 scale = get (ca, strcat (ax, "scale")); |
322 if (! iscell (data)) | 322 if (! iscell (data)) |
323 data = {data}; | 323 data = {data}; |
324 end | 324 end |
325 if (strcmp (scale, "log")) | 325 if (strcmp (scale, "log")) |
326 data = cellfun (@(x) x(x>0), data, "uniformoutput", false); | 326 tmp = data; |
327 data = cellfun (@(x) x(x>0), tmp, "uniformoutput", false); | |
328 n = cellfun (@isempty, data); | |
329 data(n) = cellfun (@(x) x(x<0), tmp(n), "uniformoutput", false); | |
327 endif | 330 endif |
328 data = cellfun (@(x) x(isfinite(x)), data, "uniformoutput", false); | 331 data = cellfun (@(x) x(isfinite(x)), data, "uniformoutput", false); |
329 data = data(! cellfun ("isempty", data)); | 332 data = data(! cellfun ("isempty", data)); |
330 if (! isempty (data)) | 333 if (! isempty (data)) |
331 lims_min = min (cellfun (@(x) min (x(:)), data(:))); | 334 lims_min = min (cellfun (@(x) min (x(:)), data(:))); |
552 %! unwind_protect | 555 %! unwind_protect |
553 %! plot (11:20, [21:24, NaN, -Inf, 27:30]); | 556 %! plot (11:20, [21:24, NaN, -Inf, 27:30]); |
554 %! hold all; | 557 %! hold all; |
555 %! plot (11:20, 25.5 + rand (10)); | 558 %! plot (11:20, 25.5 + rand (10)); |
556 %! axis tight; | 559 %! axis tight; |
557 %! assert (axis, [11 20 21 30]); | 560 %! assert (axis (), [11 20 21 30]); |
558 %! unwind_protect_cleanup | 561 %! unwind_protect_cleanup |
559 %! close (hf); | 562 %! close (hf); |
560 %! end_unwind_protect | 563 %! end_unwind_protect |
561 | 564 |
565 %!test | |
566 %! hf = figure ("visible", "off"); | |
567 %! unwind_protect | |
568 %! a = logspace (-5, 1, 10); | |
569 %! loglog (a, -a) | |
570 %! axis tight; | |
571 %! assert (axis (), [1e-5, 10, -10, -1e-5]) | |
572 %! unwind_protect_cleanup | |
573 %! close (hf); | |
574 %! end_unwind_protect | |
575 |