Mercurial > hg > octave-lyh
diff scripts/plot/subplot.m @ 6425:0cc5ca7b1e91
[project @ 2007-03-21 15:57:19 by jwe]
author | jwe |
---|---|
date | Wed, 21 Mar 2007 15:57:19 +0000 |
parents | 05a48d6cf163 |
children | 2110cc251779 |
line wrap: on
line diff
--- a/scripts/plot/subplot.m +++ b/scripts/plot/subplot.m @@ -117,10 +117,13 @@ yp = fix ((index-1)/columns); xp = index - yp*columns - 1; - xorigin = xp * xsize; - yorigin = (rows - yp - 1) * ysize; + x0 = xp * xsize; + y0 = (rows - yp - 1) * ysize; - pos = [xorigin, yorigin, xsize, ysize]; + pos = [x0, y0, xsize, ysize]; + + x1 = x0 + xsize; + y1 = y0 + ysize; cf = gcf (); @@ -132,10 +135,23 @@ for child = obj.children obj = get (child); if (strcmp (obj.type, "axes")) - if (obj.outerposition == pos) + objpos = obj.outerposition; + if (objpos == pos) + ## If the new axes are in exactly the same position as an + ## existing axes object, use the existing axes. found = true; tmp = child; break; + else + ## If the new axes overlap an old axes object, delete the old + ## axes. + objx0 = objpos(1); + objx1 = objx0 + objpos(3); + objy0 = objpos(2); + objy1 = objy0 + objpos(4); + if (! (x0 >= objx1 || x1 <= objx0 || y0 >= objy1 || y1 <= objy0)) + delete (child); + endif endif endif endfor