Mercurial > hg > octave-lojdl
changeset 8804:995f8b064b32
subplot.m: Compatible placement of subplots.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Wed, 18 Feb 2009 11:53:56 -0500 |
parents | 35ea4f816bc9 |
children | 065a05eb148a |
files | scripts/ChangeLog scripts/plot/subplot.m |
diffstat | 2 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-02-18 Ben Abbott <bpabbott@mac.com> + + * plot/subplot.m: Fix unintended deletion of axes. + 2009-02-18 Frederick Umminger <Frederick_Umminger@playstation.sony.com> * audio/wavread.m: Improve search for data chunks.
--- a/scripts/plot/subplot.m +++ b/scripts/plot/subplot.m @@ -103,7 +103,7 @@ units = get (0, "defaultaxesunits"); unwind_protect set (0, "defaultaxesunits", "normalized") - pos = subplot_position (rows, columns, index, "outerposition", units); + pos = subplot_position (rows, columns, index, "position", units); cf = gcf (); @@ -125,7 +125,7 @@ strcmp (get (child, "tag"), "colorbar")) continue; endif - objpos = get (child, "outerposition"); + objpos = get (child, "position"); if (all (objpos == pos)) ## If the new axes are in exactly the same position as an ## existing axes object, use the existing axes. @@ -152,6 +152,7 @@ if (found) set (cf, "currentaxes", tmp); else + pos = subplot_position (rows, columns, index, "outerposition", units); pos2 = subplot_position (rows, columns, index, "position", units); tmp = axes ("outerposition", pos, "position", pos2); endif @@ -198,7 +199,7 @@ ## Calculate the outerposition/position inset if (rows > 1) inset.top = 8/420; - inset.bottom = max (polyval ([0.1382,-0.0026], width), 16/420); + inset.bottom = max (polyval ([0.1382,-0.0026], height), 16/420); else inset.bottom = margins.bottom; inset.top = margins.top; @@ -228,6 +229,11 @@ x0 = xp .* (width + margins.column) + margins.left; y0 = yp .* (height + margins.row) + margins.bottom; + if (strcmp (position_property, "outerposition") ) + x0 = x0 - inset.left; + y0 = y0 - inset.bottom; + endif + if (numel(x0) > 1) x1 = max (x0) + width; y1 = max (y0) + height;