Mercurial > hg > octave-nkf
annotate scripts/plot/colorbar.m @ 8653:2479ebf1c33f
doc/interpreter/system.txi: remove reference to 'eomdate'
author | Soren Hauberg <hauberg@gmail.com> |
---|---|
date | Sun, 01 Feb 2009 16:30:29 +0100 |
parents | cadc73247d65 |
children | 5dd06f19e9be |
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}) | |
8507 | 21 ## @deftypefnx {Function File} {} colorbar ("peer", @var{h}, @dots{}) |
7189 | 22 ## Adds a colorbar to the current axes. Valid values for @var{s} are |
23 ## | |
24 ## @table @asis | |
8507 | 25 ## @item "EastOutside" |
7189 | 26 ## Place the colorbar outside the plot to the right. This is the default. |
8507 | 27 ## @item "East" |
7189 | 28 ## Place the colorbar inside the plot to the right. |
8507 | 29 ## @item "WestOutside" |
7189 | 30 ## Place the colorbar outside the plot to the left. |
8507 | 31 ## @item "West" |
7189 | 32 ## Place the colorbar inside the plot to the left. |
8507 | 33 ## @item "NorthOutside" |
7189 | 34 ## Place the colorbar above the plot. |
8507 | 35 ## @item "North" |
7189 | 36 ## Place the colorbar at the top of the plot. |
8507 | 37 ## @item "SouthOutside" |
7189 | 38 ## Place the colorbar under the plot. |
8507 | 39 ## @item "South" |
7189 | 40 ## Place the colorbar at the bottom of the plot. |
8507 | 41 ## @item "Off", "None" |
7189 | 42 ## Remove any existing colorbar from the plot. |
43 ## @end table | |
44 ## | |
8507 | 45 ## If the argument "peer" is given, then the following argument is treated |
7264 | 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) | |
8507 | 65 error ("colorbar: missing axes handle after \"peer\""); |
8208 | 66 else |
67 ax = vargin{i++} | |
68 if (!isscalar (ax) || ! ishandle (ax) | |
69 || strcmp (get (ax, "type"), "axes")) | |
8507 | 70 error ("colorbar: expecting an axes handle following \"peer\""); |
8208 | 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 set (cax, "dataaspectratio", aspect); | |
8101
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
240 endif |
8208 | 241 endif |
242 endfunction | |
243 | |
244 function [pos, cpos, vertical, mirr, aspect] = __position_colorbox__ (cbox, obj, cf) | |
245 | |
246 pos = obj.position; | |
247 sz = pos(3:4); | |
248 | |
249 off = 0; | |
250 if (strcmpi (obj.dataaspectratiomode, "manual")) | |
251 r = obj.dataaspectratio; | |
252 if (pos(3) > pos(4)) | |
253 switch (cbox) | |
254 case {"east", "eastoutside", "west", "westoutside"} | |
255 off = [(pos(3) - pos(4)) ./ (r(2) / r(1)), 0]; | |
256 endswitch | |
257 else | |
258 switch (cbox) | |
259 case {"north", "northoutside", "south", "southoutside"} | |
260 off = [0, (pos(4) - pos(3)) ./ (r(1) / r(2))]; | |
261 ## This shouldn't be here except that gnuplot doesn't have a | |
262 ## square window and so a square aspect ratio is not square. | |
263 ## The corrections are empirical. | |
264 if (strcmp (get (cf, "__backend__"), "gnuplot")) | |
265 if (length (cbox) > 7 && strcmp (cbox(end-6:end),"outside")) | |
266 off = off / 2; | |
267 else | |
268 off = off / 1.7; | |
269 endif | |
270 endif | |
271 endswitch | |
272 endif | |
273 off = off / 2; | |
274 endif | |
8101
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
275 |
8208 | 276 switch (cbox) |
277 case "northoutside" | |
278 origin = pos(1:2) + [0., 0.9] .* sz + [1, -1] .* off; | |
279 sz = sz .* [1.0, 0.06]; | |
280 pos(4) = 0.8 * pos(4); | |
281 mirr = true; | |
282 vertical = false; | |
283 case "north" | |
284 origin = pos(1:2) + [0.05, 0.9] .* sz + [1, -1] .* off; | |
285 sz = sz .* [1.0, 0.06] * 0.9; | |
286 mirr = false; | |
287 vertical = false; | |
288 case "southoutside" | |
289 origin = pos(1:2) + off; | |
290 sz = sz .* [1.0, 0.06]; | |
291 pos(2) = pos(2) + pos(4) * 0.2; | |
292 pos(4) = 0.8 * pos(4); | |
293 mirr = false; | |
294 vertical = false; | |
295 case "south" | |
296 origin = pos(1:2) + [0.05, 0.05] .* sz + off; | |
297 sz = sz .* [1.0, 0.06] * 0.9; | |
298 mirr = true; | |
299 vertical = false; | |
300 case "eastoutside" | |
301 origin = pos(1:2) + [0.9, 0] .* sz + [-1, 1] .* off; | |
302 sz = sz .* [0.06, 1.0]; | |
303 pos(3) = 0.8 * pos(3); | |
304 mirr = true; | |
305 vertical = true; | |
306 case "east" | |
307 origin = pos(1:2) + [0.9, 0.05] .* sz + [-1, 1] .* off; | |
308 sz = sz .* [0.06, 1.0] * 0.9; | |
309 mirr = false; | |
310 vertical = true; | |
311 case "westoutside" | |
312 origin = pos(1:2) + off; | |
313 sz = sz .* [0.06, 1.0]; | |
314 pos(1) = pos(1) + pos(3) * 0.2; | |
315 pos(3) = 0.8 * pos(3); | |
316 mirr = false; | |
317 vertical = true; | |
318 case "west" | |
319 origin = pos(1:2) + [0.05, 0.05] .* sz + off; | |
320 sz = sz .* [0.06, 1.0] .* 0.9; | |
321 mirr = true; | |
322 vertical = true; | |
323 endswitch | |
324 | |
325 cpos = [origin, sz]; | |
326 | |
327 if (strcmpi (obj.dataaspectratiomode, "manual")) | |
328 r = obj.dataaspectratio; | |
329 | |
330 if (pos(3) > pos(4)) | |
331 if (vertical) | |
332 aspect = [1, 0.21, 1]; | |
333 else | |
334 aspect = [0.21, 1, 1]; | |
335 endif | |
336 else | |
337 if (vertical) | |
338 aspect = [1, 0.21, 1]; | |
339 else | |
340 aspect = [0.21, 1, 1]; | |
341 endif | |
342 endif | |
343 else | |
344 aspect = NaN; | |
345 endif | |
8101
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
346 |
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
347 endfunction |
86955a1559c5
improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents:
7726
diff
changeset
|
348 |
7189 | 349 %!demo |
350 %! hold off; | |
351 %! close all; | |
352 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
353 %! imagesc(x) | |
354 %! colorbar(); | |
355 | |
356 %!demo | |
357 %! hold off; | |
358 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
359 %! imagesc(x) | |
360 %! colorbar("westoutside"); | |
361 | |
362 %!demo | |
363 %! hold off; | |
364 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
365 %! imagesc(x) | |
366 %! colorbar("northoutside"); | |
367 | |
368 %!demo | |
369 %! hold off; | |
370 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
371 %! imagesc(x) | |
372 %! colorbar("southoutside"); | |
373 | |
374 %!demo | |
375 %! hold off; | |
376 %! subplot(2,2,1) | |
377 %! contour(peaks()) | |
378 %! colorbar("east"); | |
379 %! subplot(2,2,2) | |
380 %! contour(peaks()) | |
381 %! colorbar("west"); | |
382 %! subplot(2,2,3) | |
383 %! contour(peaks()) | |
384 %! colorbar("north"); | |
385 %! subplot(2,2,4) | |
386 %! contour(peaks()) | |
387 %! colorbar("south"); | |
388 | |
389 %!demo | |
390 %! hold off; | |
391 %! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); | |
392 %! subplot(2,2,1) | |
393 %! imagesc(x) | |
394 %! colorbar(); | |
395 %! subplot(2,2,2) | |
396 %! imagesc(x) | |
397 %! colorbar("westoutside"); | |
398 %! subplot(2,2,3) | |
399 %! imagesc(x) | |
400 %! colorbar("northoutside"); | |
401 %! subplot(2,2,4) | |
402 %! imagesc(x) | |
403 %! colorbar("southoutside"); | |
404 | |
7726
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
405 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
406 %! 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
|
407 %! 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
|
408 %! 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
|
409 %! 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
|
410 %! 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
|
411 %! colorbar(); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
412 %! 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
|
413 %! 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
|
414 %! 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
|
415 %! 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
|
416 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
417 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
418 %! 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
|
419 %! 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
|
420 %! 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
|
421 %! 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
|
422 %! 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
|
423 %! 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
|
424 %! 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
|
425 %! 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
|
426 %! 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
|
427 %! 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
|
428 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
429 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
430 %! 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
|
431 %! 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
|
432 %! 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
|
433 %! 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
|
434 %! 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
|
435 %! colorbar(); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
436 %! 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
|
437 %! 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
|
438 %! 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
|
439 %! 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
|
440 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
441 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
442 %! 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
|
443 %! 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
|
444 %! 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
|
445 %! 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
|
446 %! 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
|
447 %! 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
|
448 %! 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
|
449 %! 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
|
450 %! 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
|
451 %! 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
|
452 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
453 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
454 %! 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
|
455 %! 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
|
456 %! 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
|
457 %! 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
|
458 %! colorbar(); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
459 %! 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
|
460 %! 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
|
461 %! 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
|
462 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
463 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
464 %! 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
|
465 %! 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
|
466 %! 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
|
467 %! 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
|
468 %! 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
|
469 %! 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
|
470 %! 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
|
471 %! 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
|
472 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
473 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
474 %! 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
|
475 %! 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
|
476 %! 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
|
477 %! 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
|
478 %! colorbar(); |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
479 %! 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
|
480 %! 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
|
481 %! 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
|
482 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
483 %!demo |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
484 %! 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
|
485 %! 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
|
486 %! 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
|
487 %! 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
|
488 %! 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
|
489 %! 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
|
490 %! 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
|
491 %! 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
|
492 |
1b954fdaf4ff
Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents:
7264
diff
changeset
|
493 |