Mercurial > hg > octave-lyh
annotate scripts/plot/colorbar.m @ 8228:53dbbd331498
Preserve font and position properties when axes are replace in the handle code
author | David Bateman <dbateman@free.fr> |
---|---|
date | Thu, 16 Oct 2008 14:49:08 +0100 |
parents | f6ca8ff51818 |
children | 7799d8c38312 |
rev | line source |
---|---|
8208 | 1 ## Copyright (C) 2008 David Bateman |
7189 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Function File} {} colorbar (@var{s}) | |
21 ## @deftypefnx {Function File} {} colorbar ('peer', @var{h}, @dots{}) | |
22 ## Adds a colorbar to the current axes. Valid values for @var{s} are | |
23 ## | |
24 ## @table @asis | |
25 ## @item 'EastOutside' | |
26 ## Place the colorbar outside the plot to the right. This is the default. | |
27 ## @item 'East' | |
28 ## Place the colorbar inside the plot to the right. | |
29 ## @item 'WestOutside' | |
30 ## Place the colorbar outside the plot to the left. | |
31 ## @item 'West' | |
32 ## Place the colorbar inside the plot to the left. | |
33 ## @item 'NorthOutside' | |
34 ## Place the colorbar above the plot. | |
35 ## @item 'North' | |
36 ## Place the colorbar at the top of the plot. | |
37 ## @item 'SouthOutside' | |
38 ## Place the colorbar under the plot. | |
39 ## @item 'South' | |
40 ## Place the colorbar at the bottom of the plot. | |
41 ## @item 'Off', 'None' | |
42 ## Remove any existing colorbar from the plot. | |
43 ## @end table | |
44 ## | |
7264 | 45 ## If the argument 'peer' is given, then the following argument is treated |
46 ## as the axes handle on which to add the colorbar. | |
7189 | 47 ## @end deftypefn |
48 | |
49 | |
8102 | 50 ## PKG_ADD: mark_as_command colorbar |
7189 | 51 |
8208 | 52 function h = colorbar (varargin) |
53 ax = []; | |
54 loc = "eastoutside"; | |
55 args = {}; | |
56 deleting = false; | |
57 | |
58 i = 1; | |
59 while (i <= nargin) | |
60 arg = varargin {i++}; | |
8101
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
61 |
8208 | 62 if (ischar(arg)) |
63 if (strcmpi (arg, "peer")) | |
64 if (i > nargin) | |
65 error ("colorbar: missing axes handle after 'peer'"); | |
66 else | |
67 ax = vargin{i++} | |
68 if (!isscalar (ax) || ! ishandle (ax) | |
69 || strcmp (get (ax, "type"), "axes")) | |
70 error ("colorbar: expecting an axes handle following 'peer'"); | |
71 endif | |
72 endif | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8102
diff
changeset
|
73 elseif (strcmpi (arg, "north") || strcmpi (arg, "south") |
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8102
diff
changeset
|
74 || strcmpi (arg, "east") || strcmpi (arg, "west") |
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8102
diff
changeset
|
75 || strcmpi (arg, "northoutside") || strcmpi (arg, "southoutside") |
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8102
diff
changeset
|
76 || strcmpi (arg, "eastoutside") || strcmpi (arg, "westoutside")) |
8208 | 77 loc = arg; |
78 elseif (strcmpi (arg, "off") || strcmpi (arg, "none")) | |
79 deleting = true; | |
8101
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
80 else |
8208 | 81 args{end+1} = arg; |
82 endif | |
83 else | |
84 args{end+1} = arg; | |
85 endif | |
86 endwhile | |
87 | |
88 if (isempty (ax)) | |
89 ax = gca (); | |
90 endif | |
91 obj = get (ax); | |
92 | |
93 if (deleting) | |
94 objs = findobj (get (ax, "parent"), "type", "axes"); | |
95 for i = 1 : length (objs) | |
96 if (strcmp (get (objs(i), "tag"), "colorbar") && | |
97 get (objs(i), "axes") == ax) | |
98 delete (objs(i)); | |
99 endif | |
100 endfor | |
101 else | |
102 position = obj.position; | |
103 clen = rows (get (get (ax, "parent"), "colormap")); | |
104 cext = get (ax, "clim"); | |
105 cdiff = (cext(2) - cext(1)) / clen / 2; | |
106 cmin = cext(1) + cdiff; | |
107 cmax = cext(2) - cdiff; | |
108 | |
109 orig_pos = obj.position; | |
110 orig_opos = obj.outerposition; | |
111 [pos, cpos, vertical, mirror, aspect] = ... | |
112 __position_colorbox__ (loc, obj, ancestor (ax, "figure")); | |
113 set (ax, "activepositionproperty", "position", "position", pos); | |
114 | |
115 cax = __go_axes__ (get (ax, "parent"), "tag", "colorbar", | |
116 "handlevisibility", "off", | |
117 "activepositionproperty", "position", | |
118 "position", cpos); | |
119 addproperty ("location", cax, "radio", | |
120 "eastoutside|east|westoutside|west|northoutside|north|southoutside|south", | |
121 loc); | |
122 addproperty ("axes", cax, "handle", ax); | |
123 | |
124 if (vertical) | |
125 hi = image (cax, [0,1], [cmin, cmax], [1 : clen]'); | |
126 if (mirror) | |
127 set (cax, "xtick", [], "xdir", "normal", "ydir", "normal", | |
128 "ylim", cext, "ylimmode", "manual", | |
129 "yaxislocation", "right", args{:}); | |
130 else | |
131 set (cax, "xtick", [], "xdir", "normal", "ydir", "normal", | |
132 "ylim", cext, "ylimmode", "manual", | |
133 "yaxislocation", "left", args{:}); | |
8101
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
134 endif |
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
135 else |
8208 | 136 hi = image (cax, [cmin, cmax], [0,1], [1 : clen]); |
137 if (mirror) | |
138 set (cax, "ytick", [], "xdir", "normal", "ydir", "normal", | |
139 "xlim", cext, "xlimmode", "manual", | |
140 "xaxislocation", "top", args{:}); | |
141 else | |
142 set (cax, "ytick", [], "xdir", "normal", "ydir", "normal", | |
143 "xlim", cext, "xlimmode", "manual", | |
144 "xaxislocation", "bottom", args{:}); | |
145 endif | |
146 endif | |
147 | |
148 if (! isnan (aspect)) | |
149 set (cax, "dataaspectratio", aspect); | |
150 endif | |
151 | |
152 ctext = text (0, 0, "", "tag", "colorbar","visible", "off", | |
153 "handlevisibility", "off", "xliminclude", "off", | |
154 "yliminclude", "off", "zliminclude", "off", | |
155 "deletefcn", {@deletecolorbar, cax, orig_pos, orig_opos}); | |
156 | |
157 set (cax, "deletefcn", {@resetaxis, orig_pos, orig_opos}); | |
158 | |
159 addlistener (ax, "clim", {@update_colorbar_clim, hi, vertical}) | |
160 addlistener (ax, "dataaspectratio", {@update_colorbar_axis, cax}) | |
161 addlistener (ax, "position", {@update_colorbar_axis, cax}) | |
162 | |
163 endif | |
164 | |
165 if (nargout > 0) | |
166 h = cax; | |
167 endif | |
168 endfunction | |
169 | |
170 function deletecolorbar (h, d, hc, pos, opos) | |
171 ## Don't delete the colorbar and reset the axis size if the | |
172 ## parent figure is being deleted. | |
173 if (ishandle (hc) && strcmp (get (hc, "type"), "axes") && | |
174 (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off"))) | |
175 if (strcmp (get (hc, "beingdeleted"), "off")) | |
176 delete (hc); | |
177 endif | |
178 if (!isempty (ancestor (h, "axes")) && | |
179 strcmp (get (ancestor (h, "axes"), "beingdeleted"), "off")) | |
180 set (ancestor (h, "axes"), "position", pos, "outerposition", opos); | |
181 endif | |
182 endif | |
183 endfunction | |
184 | |
185 function resetaxis (h, d, pos, opos) | |
186 if (ishandle (h) && strcmp (get (h, "type"), "axes") && | |
187 (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")) && | |
188 ishandle (get (h, "axes"))) | |
8228
53dbbd331498
Preserve font and position properties when axes are replace in the handle code
David Bateman <dbateman@free.fr>
parents:
8208
diff
changeset
|
189 set (get (h, "axes"), "position", pos, "outerposition", opos); |
8208 | 190 endif |
191 endfunction | |
192 | |
193 function update_colorbar_clim (h, d, hi, vert) | |
194 if (ishandle (h) && strcmp (get (h, "type"), "image") && | |
195 (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off"))) | |
196 clen = rows (get (get (h, "parent"), "colormap")); | |
197 cext = get (h, "clim"); | |
198 cdiff = (cext(2) - cext(1)) / clen / 2; | |
199 cmin = cext(1) + cdiff; | |
200 cmax = cext(2) - cdiff; | |
201 | |
202 if (vert) | |
203 set (hi, "ydata", [cmin, cmax]); | |
204 set (get (hi, "parent"), "ylim", cext); | |
205 else | |
206 set (hi, "xdata", [cmin, cmax]); | |
207 set (get (hi, "parent"), "xlim", cext); | |
208 endif | |
209 endif | |
210 endfunction | |
211 | |
212 function update_colorbar_axis (h, d, cax) | |
213 if (ishandle (cax) && strcmp (get (cax, "type"), "axes") && | |
214 (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off"))) | |
215 loc = get (cax, "location"); | |
216 obj = get (h); | |
217 [pos, cpos, vertical, mirror, aspect] = ... | |
218 __position_colorbox__ (loc, obj, ancestor (h, "figure")); | |
219 | |
220 if (vertical) | |
221 if (mirror) | |
222 set (cax, "xtick", [], "xdir", "normal", "ydir", "normal", | |
223 "yaxislocation", "right", "position", cpos); | |
224 else | |
225 set (cax, "xtick", [], "xdir", "normal", "ydir", "normal", | |
226 "yaxislocation", "left", "position", cpos); | |
227 endif | |
228 else | |
229 if (mirror) | |
230 set (cax, "ytick", [], "xdir", "normal", "ydir", "normal", | |
231 "xaxislocation", "top", "position", cpos); | |
232 else | |
233 set (cax, "ytick", [], "xdir", "normal", "ydir", "normal", | |
234 "xaxislocation", "bottom", "position", cpos); | |
235 endif | |
236 endif | |
237 | |
238 if (! isnan (aspect)) | |
239 aspect | |
240 set (cax, "dataaspectratio", aspect); | |
8101
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
241 endif |
8208 | 242 endif |
243 endfunction | |
244 | |
245 function [pos, cpos, vertical, mirr, aspect] = __position_colorbox__ (cbox, obj, cf) | |
246 | |
247 pos = obj.position; | |
248 sz = pos(3:4); | |
249 | |
250 off = 0; | |
251 if (strcmpi (obj.dataaspectratiomode, "manual")) | |
252 r = obj.dataaspectratio; | |
253 if (pos(3) > pos(4)) | |
254 switch (cbox) | |
255 case {"east", "eastoutside", "west", "westoutside"} | |
256 off = [(pos(3) - pos(4)) ./ (r(2) / r(1)), 0]; | |
257 endswitch | |
258 else | |
259 switch (cbox) | |
260 case {"north", "northoutside", "south", "southoutside"} | |
261 off = [0, (pos(4) - pos(3)) ./ (r(1) / r(2))]; | |
262 ## This shouldn't be here except that gnuplot doesn't have a | |
263 ## square window and so a square aspect ratio is not square. | |
264 ## The corrections are empirical. | |
265 if (strcmp (get (cf, "__backend__"), "gnuplot")) | |
266 if (length (cbox) > 7 && strcmp (cbox(end-6:end),"outside")) | |
267 off = off / 2; | |
268 else | |
269 off = off / 1.7; | |
270 endif | |
271 endif | |
272 endswitch | |
273 endif | |
274 off = off / 2; | |
275 endif | |
8101
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
276 |
8208 | 277 switch (cbox) |
278 case "northoutside" | |
279 origin = pos(1:2) + [0., 0.9] .* sz + [1, -1] .* off; | |
280 sz = sz .* [1.0, 0.06]; | |
281 pos(4) = 0.8 * pos(4); | |
282 mirr = true; | |
283 vertical = false; | |
284 case "north" | |
285 origin = pos(1:2) + [0.05, 0.9] .* sz + [1, -1] .* off; | |
286 sz = sz .* [1.0, 0.06] * 0.9; | |
287 mirr = false; | |
288 vertical = false; | |
289 case "southoutside" | |
290 origin = pos(1:2) + off; | |
291 sz = sz .* [1.0, 0.06]; | |
292 pos(2) = pos(2) + pos(4) * 0.2; | |
293 pos(4) = 0.8 * pos(4); | |
294 mirr = false; | |
295 vertical = false; | |
296 case "south" | |
297 origin = pos(1:2) + [0.05, 0.05] .* sz + off; | |
298 sz = sz .* [1.0, 0.06] * 0.9; | |
299 mirr = true; | |
300 vertical = false; | |
301 case "eastoutside" | |
302 origin = pos(1:2) + [0.9, 0] .* sz + [-1, 1] .* off; | |
303 sz = sz .* [0.06, 1.0]; | |
304 pos(3) = 0.8 * pos(3); | |
305 mirr = true; | |
306 vertical = true; | |
307 case "east" | |
308 origin = pos(1:2) + [0.9, 0.05] .* sz + [-1, 1] .* off; | |
309 sz = sz .* [0.06, 1.0] * 0.9; | |
310 mirr = false; | |
311 vertical = true; | |
312 case "westoutside" | |
313 origin = pos(1:2) + off; | |
314 sz = sz .* [0.06, 1.0]; | |
315 pos(1) = pos(1) + pos(3) * 0.2; | |
316 pos(3) = 0.8 * pos(3); | |
317 mirr = false; | |
318 vertical = true; | |
319 case "west" | |
320 origin = pos(1:2) + [0.05, 0.05] .* sz + off; | |
321 sz = sz .* [0.06, 1.0] .* 0.9; | |
322 mirr = true; | |
323 vertical = true; | |
324 endswitch | |
325 | |
326 cpos = [origin, sz]; | |
327 | |
328 if (strcmpi (obj.dataaspectratiomode, "manual")) | |
329 r = obj.dataaspectratio; | |
330 | |
331 if (pos(3) > pos(4)) | |
332 if (vertical) | |
333 aspect = [1, 0.21, 1]; | |
334 else | |
335 aspect = [0.21, 1, 1]; | |
336 endif | |
337 else | |
338 if (vertical) | |
339 aspect = [1, 0.21, 1]; | |
340 else | |
341 aspect = [0.21, 1, 1]; | |
342 endif | |
343 endif | |
344 else | |
345 aspect = NaN; | |
346 endif | |
8101
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
347 |
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
348 endfunction |
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
349 |
7189 | 350 %!demo |
351 %! hold off; | |
352 %! close all; | |
353 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
354 %! imagesc(x) | |
355 %! colorbar(); | |
356 | |
357 %!demo | |
358 %! hold off; | |
359 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
360 %! imagesc(x) | |
361 %! colorbar("westoutside"); | |
362 | |
363 %!demo | |
364 %! hold off; | |
365 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
366 %! imagesc(x) | |
367 %! colorbar("northoutside"); | |
368 | |
369 %!demo | |
370 %! hold off; | |
371 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
372 %! imagesc(x) | |
373 %! colorbar("southoutside"); | |
374 | |
375 %!demo | |
376 %! hold off; | |
377 %! subplot(2,2,1) | |
378 %! contour(peaks()) | |
379 %! colorbar("east"); | |
380 %! subplot(2,2,2) | |
381 %! contour(peaks()) | |
382 %! colorbar("west"); | |
383 %! subplot(2,2,3) | |
384 %! contour(peaks()) | |
385 %! colorbar("north"); | |
386 %! subplot(2,2,4) | |
387 %! contour(peaks()) | |
388 %! colorbar("south"); | |
389 | |
390 %!demo | |
391 %! hold off; | |
392 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
393 %! subplot(2,2,1) | |
394 %! imagesc(x) | |
395 %! colorbar(); | |
396 %! subplot(2,2,2) | |
397 %! imagesc(x) | |
398 %! colorbar("westoutside"); | |
399 %! subplot(2,2,3) | |
400 %! imagesc(x) | |
401 %! colorbar("northoutside"); | |
402 %! subplot(2,2,4) | |
403 %! imagesc(x) | |
404 %! colorbar("southoutside"); | |
405 | |
7726
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
406 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
407 %! hold off; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
408 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
409 %! subplot(1,2,1) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
410 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
411 %! axis square; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
412 %! colorbar(); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
413 %! subplot(1,2,2) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
414 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
415 %! axis square; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
416 %! colorbar("westoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
417 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
418 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
419 %! hold off; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
420 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
421 %! subplot(1,2,1) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
422 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
423 %! axis square; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
424 %! colorbar("northoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
425 %! subplot(1,2,2) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
426 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
427 %! axis square; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
428 %! colorbar("southoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
429 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
430 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
431 %! hold off; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
432 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
433 %! subplot(2,1,1) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
434 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
435 %! axis square; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
436 %! colorbar(); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
437 %! subplot(2,1,2) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
438 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
439 %! axis square; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
440 %! colorbar("westoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
441 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
442 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
443 %! hold off; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
444 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
445 %! subplot(2,1,1) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
446 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
447 %! axis square; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
448 %! colorbar("northoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
449 %! subplot(2,1,2) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
450 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
451 %! axis square; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
452 %! colorbar("southoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
453 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
454 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
455 %! hold off; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
456 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
457 %! subplot(1,2,1) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
458 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
459 %! colorbar(); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
460 %! subplot(1,2,2) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
461 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
462 %! colorbar("westoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
463 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
464 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
465 %! hold off; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
466 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
467 %! subplot(1,2,1) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
468 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
469 %! colorbar("northoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
470 %! subplot(1,2,2) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
471 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
472 %! colorbar("southoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
473 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
474 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
475 %! hold off; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
476 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
477 %! subplot(2,1,1) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
478 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
479 %! colorbar(); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
480 %! subplot(2,1,2) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
481 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
482 %! colorbar("westoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
483 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
484 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
485 %! hold off; |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
486 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
487 %! subplot(2,1,1) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
488 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
489 %! colorbar("northoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
490 %! subplot(2,1,2) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
491 %! imagesc(x) |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
492 %! colorbar("southoutside"); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
493 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
494 |