comparison 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
comparison
equal deleted inserted replaced
6424:05a48d6cf163 6425:0cc5ca7b1e91
115 ysize = 1 / rows; 115 ysize = 1 / rows;
116 116
117 yp = fix ((index-1)/columns); 117 yp = fix ((index-1)/columns);
118 xp = index - yp*columns - 1; 118 xp = index - yp*columns - 1;
119 119
120 xorigin = xp * xsize; 120 x0 = xp * xsize;
121 yorigin = (rows - yp - 1) * ysize; 121 y0 = (rows - yp - 1) * ysize;
122 122
123 pos = [xorigin, yorigin, xsize, ysize]; 123 pos = [x0, y0, xsize, ysize];
124
125 x1 = x0 + xsize;
126 y1 = y0 + ysize;
124 127
125 cf = gcf (); 128 cf = gcf ();
126 129
127 set (cf, "nextplot", "add"); 130 set (cf, "nextplot", "add");
128 131
130 133
131 found = false; 134 found = false;
132 for child = obj.children 135 for child = obj.children
133 obj = get (child); 136 obj = get (child);
134 if (strcmp (obj.type, "axes")) 137 if (strcmp (obj.type, "axes"))
135 if (obj.outerposition == pos) 138 objpos = obj.outerposition;
139 if (objpos == pos)
140 ## If the new axes are in exactly the same position as an
141 ## existing axes object, use the existing axes.
136 found = true; 142 found = true;
137 tmp = child; 143 tmp = child;
138 break; 144 break;
145 else
146 ## If the new axes overlap an old axes object, delete the old
147 ## axes.
148 objx0 = objpos(1);
149 objx1 = objx0 + objpos(3);
150 objy0 = objpos(2);
151 objy1 = objy0 + objpos(4);
152 if (! (x0 >= objx1 || x1 <= objx0 || y0 >= objy1 || y1 <= objy0))
153 delete (child);
154 endif
139 endif 155 endif
140 endif 156 endif
141 endfor 157 endfor
142 158
143 if (found) 159 if (found)