# HG changeset patch # User Kai Habel # Date 1317292299 -7200 # Node ID e36c2f4ea8f554771386c04228af81071681ca73 # Parent 0c69a564f2beb9b417cdb7da61335275b6cf819a Set clim correctly for patch objects: src/graphics.cc: (update_axis_limits): set min_val correctly. scripts/plot/patch.m: test for this fix. diff --git a/scripts/plot/patch.m b/scripts/plot/patch.m --- 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 diff --git a/src/graphics.cc b/src/graphics.cc --- 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);