Mercurial > hg > octave-lyh
changeset 13247:e36c2f4ea8f5
Set clim correctly for patch objects:
src/graphics.cc: (update_axis_limits): set min_val correctly.
scripts/plot/patch.m: test for this fix.
author | Kai Habel <kai.habel@gmx.de> |
---|---|
date | Thu, 29 Sep 2011 12:31:39 +0200 |
parents | 0c69a564f2be |
children | 7861a5fd3479 |
files | scripts/plot/patch.m src/graphics.cc |
diffstat | 2 files changed, 20 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/patch.m +++ b/scripts/plot/patch.m @@ -172,3 +172,15 @@ %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect + +%!test +%! hf = figure ("visible", "off"); +%! c = 0.9; +%! unwind_protect +%! h = patch ([0 1 0], [0 1 1], c); +%! assert (get (gca, "clim"), [c - 1, c + 1]); +%! h = patch ([0 1 0], [0 1 1], 2 * c); +%! assert (get (gca, "clim"), [c, 2 * c]); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect \ No newline at end of file
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -5668,7 +5668,10 @@ max_val = 1; } else if (min_val == max_val) - max_val = min_val + 1; + { + max_val = min_val + 1; + min_val -= 1; + } limits.resize (1, 2); @@ -5829,7 +5832,10 @@ max_val = 1; } else if (min_val == max_val) - max_val = min_val + 1; + { + max_val = min_val + 1; + min_val -= 1; + } limits.resize (1, 2);