# HG changeset patch # User Ben Abbott # Date 1234976036 18000 # Node ID 995f8b064b323fef2aac074ad162e5b05d1c1360 # Parent 35ea4f816bc95b9a7fa4c7dc1712165541f4e383 subplot.m: Compatible placement of subplots. diff -r 35ea4f816bc9 -r 995f8b064b32 scripts/ChangeLog --- a/scripts/ChangeLog Wed Feb 18 11:27:47 2009 -0500 +++ b/scripts/ChangeLog Wed Feb 18 11:53:56 2009 -0500 @@ -1,3 +1,7 @@ +2009-02-18 Ben Abbott + + * plot/subplot.m: Fix unintended deletion of axes. + 2009-02-18 Frederick Umminger * audio/wavread.m: Improve search for data chunks. diff -r 35ea4f816bc9 -r 995f8b064b32 scripts/plot/subplot.m --- a/scripts/plot/subplot.m Wed Feb 18 11:27:47 2009 -0500 +++ b/scripts/plot/subplot.m Wed Feb 18 11:53:56 2009 -0500 @@ -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;