annotate scripts/plot/colorbar.m @ 17126:eaab03308c0b

doc: Rewrite docstrings for most plot functions. Emphasize clarity, use common "voice", and increase density of seealso links. * doc/interpreter/plot.txi: Add @findex entries that were in xlim.m * scripts/miscellaneous/getappdata.m scripts/miscellaneous/setappdata.m, scripts/plot/allchild.m, scripts/plot/ancestor.m, scripts/plot/area.m, scripts/plot/axes.m, scripts/plot/axis.m, scripts/plot/bar.m, scripts/plot/barh.m, scripts/plot/box.m, scripts/plot/caxis.m, scripts/plot/cla.m, scripts/plot/clabel.m, scripts/plot/clf.m, scripts/plot/close.m, scripts/plot/closereq.m, scripts/plot/colorbar.m, scripts/plot/comet.m, scripts/plot/comet3.m, scripts/plot/compass.m, scripts/plot/contour.m, scripts/plot/contour3.m, scripts/plot/contourc.m, scripts/plot/contourf.m, scripts/plot/copyobj.m, scripts/plot/cylinder.m, scripts/plot/daspect.m, scripts/plot/diffuse.m, scripts/plot/ellipsoid.m, scripts/plot/errorbar.m, scripts/plot/ezcontour.m, scripts/plot/ezcontourf.m, scripts/plot/ezmesh.m, scripts/plot/ezmeshc.m, scripts/plot/ezplot.m, scripts/plot/ezplot3.m, scripts/plot/ezpolar.m, scripts/plot/ezsurf.m, scripts/plot/ezsurfc.m, scripts/plot/feather.m, scripts/plot/figure.m, scripts/plot/fill.m, scripts/plot/findall.m, scripts/plot/findobj.m, scripts/plot/fplot.m, scripts/plot/gca.m, scripts/plot/gcbf.m, scripts/plot/gcbo.m, scripts/plot/gcf.m, scripts/plot/gco.m, scripts/plot/ginput.m, scripts/plot/graphics_toolkit.m, scripts/plot/grid.m, scripts/plot/gtext.m, scripts/plot/guidata.m, scripts/plot/guihandles.m, scripts/plot/hdl2struct.m, scripts/plot/hggroup.m, scripts/plot/hidden.m, scripts/plot/hist.m, scripts/plot/hold.m, scripts/plot/ishghandle.m, scripts/plot/ishold.m, scripts/plot/isocolors.m, scripts/plot/isprop.m, scripts/plot/legend.m, scripts/plot/line.m, scripts/plot/linkprop.m, scripts/plot/loglog.m, scripts/plot/loglogerr.m, scripts/plot/mesh.m, scripts/plot/meshc.m, scripts/plot/meshgrid.m, scripts/plot/meshz.m, scripts/plot/newplot.m, scripts/plot/orient.m, scripts/plot/pareto.m, scripts/plot/patch.m, scripts/plot/pcolor.m, scripts/plot/peaks.m, scripts/plot/pie.m, scripts/plot/pie3.m, scripts/plot/plot.m, scripts/plot/plot3.m, scripts/plot/plotmatrix.m, scripts/plot/plotyy.m, scripts/plot/polar.m, scripts/plot/print.m, scripts/plot/quiver.m, scripts/plot/quiver3.m, scripts/plot/rectangle.m, scripts/plot/refresh.m, scripts/plot/refreshdata.m, scripts/plot/ribbon.m, scripts/plot/rose.m, scripts/plot/saveas.m, scripts/plot/scatter.m, scripts/plot/scatter3.m, scripts/plot/semilogx.m, scripts/plot/semilogxerr.m, scripts/plot/semilogy.m, scripts/plot/semilogyerr.m, scripts/plot/shading.m, scripts/plot/shg.m, scripts/plot/shrinkfaces.m, scripts/plot/slice.m, scripts/plot/specular.m, scripts/plot/sphere.m, scripts/plot/stairs.m, scripts/plot/stem.m, scripts/plot/stem3.m, scripts/plot/struct2hdl.m, scripts/plot/subplot.m, scripts/plot/surf.m, scripts/plot/surface.m, scripts/plot/surfc.m, scripts/plot/surfl.m, scripts/plot/tetramesh.m, scripts/plot/text.m, scripts/plot/title.m, scripts/plot/trimesh.m, scripts/plot/triplot.m, scripts/plot/trisurf.m, scripts/plot/view.m, scripts/plot/waitbar.m, scripts/plot/waitforbuttonpress.m, scripts/plot/waterfall.m, scripts/plot/whitebg.m, scripts/plot/xlabel.m, scripts/plot/xlim.m, scripts/plot/ylabel.m, scripts/plot/ylim.m, scripts/plot/zlabel.m, scripts/plot/zlim.m: Rewrite docstrings for most plot functions. Emphasize clarity, use common "voice", and increase density of seealso links.
author Rik <rik@octave.org>
date Wed, 31 Jul 2013 13:53:30 -0700
parents 33037eddecd2
children b5d6314314fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 12575
diff changeset
1 ## Copyright (C) 2008-2012 David Bateman
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
2 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
3 ## This file is part of Octave.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
4 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
8 ## your option) any later version.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
9 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
13 ## General Public License for more details.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
14 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
18
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
19 ## -*- texinfo -*-
17126
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17100
diff changeset
20 ## @deftypefn {Command} {} colorbar
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
21 ## @deftypefnx {Function File} {} colorbar (@var{loc})
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
22 ## @deftypefnx {Function File} {} colorbar (@var{delete_option})
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
23 ## @deftypefnx {Function File} {} colorbar (@var{hcb}, @dots{})
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
24 ## @deftypefnx {Function File} {} colorbar (@var{hax}, @dots{})
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
25 ## @deftypefnx {Function File} {} colorbar (@dots{}, "peer", @var{hax}, @dots{})
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
26 ## @deftypefnx {Function File} {} colorbar (@dots{}, "location", @var{loc}, @dots{})
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
27 ## @deftypefnx {Function File} {} colorbar (@dots{}, @var{prop}, @var{val}, @dots{})
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
28 ## @deftypefnx {Function File} {@var{h} =} colorbar (@dots{})
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
29 ## Add a colorbar to the current axes.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
30 ##
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
31 ## A colorbar displays the current colormap along with numerical rulings
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
32 ## so that the color scale can be interpreted.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
33 ##
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
34 ## The optional input @var{loc} determines the location of the colorbar.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
35 ## Valid values for @var{loc} are
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
36 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
37 ## @table @asis
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8236
diff changeset
38 ## @item "EastOutside"
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
39 ## Place the colorbar outside the plot to the right. This is the default.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
40 ##
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8236
diff changeset
41 ## @item "East"
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
42 ## Place the colorbar inside the plot to the right.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
43 ##
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8236
diff changeset
44 ## @item "WestOutside"
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
45 ## Place the colorbar outside the plot to the left.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
46 ##
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8236
diff changeset
47 ## @item "West"
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
48 ## Place the colorbar inside the plot to the left.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
49 ##
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8236
diff changeset
50 ## @item "NorthOutside"
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
51 ## Place the colorbar above the plot.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
52 ##
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8236
diff changeset
53 ## @item "North"
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
54 ## Place the colorbar at the top of the plot.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
55 ##
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8236
diff changeset
56 ## @item "SouthOutside"
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
57 ## Place the colorbar under the plot.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
58 ##
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8236
diff changeset
59 ## @item "South"
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
60 ## Place the colorbar at the bottom of the plot.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
61 ## @end table
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
62 ##
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
63 ## To remove a colorbar from a plot use any one of the following keywords for
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
64 ## the @var{delete_option}: "delete", "hide", "off".
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
65 ##
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8236
diff changeset
66 ## If the argument "peer" is given, then the following argument is treated
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
67 ## as the axes handle in which to add the colorbar. Alternatively,
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
68 ## If the first argument @var{hax} is an axes handle, then the colorbar is
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
69 ## added to this axis, rather than the current axes returned by @code{gca}.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
70 ##
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
71 ## If the first argument @var{hcb} is a handle to a colorbar object, then
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
72 ## operate on this colorbar directly.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
73 ##
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
74 ## Additional property/value pairs are passed directly to the underlying axes
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
75 ## object.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
76 ##
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
77 ## The optional return value @var{h} is a graphics handle to the created
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
78 ## colorbar object.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
79 ##
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
80 ## Implementation Note: A colorbar is created as an additional axes to the
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
81 ## current figure with the "tag" property set to "colorbar". The created
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
82 ## axes object has the extra property "location" which controls the positioning
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
83 ## of the colorbar.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
84 ## @seealso{colormap}
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
85 ## @end deftypefn
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
86
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
87 function h = colorbar (varargin)
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
88
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
89 [hcb, varargin, nargin] = __plt_get_axis_arg__ ("colorbar", varargin{:});
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
90
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
91 if (hcb && ! strcmp (get (hcb, "tag"), "colorbar"))
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
92 ax = hcb;
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
93 hcb = [];
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
94 else
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
95 ax = [];
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
96 endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
97 loc = "";
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
98 args = {};
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
99 deleting = false;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
100
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
101 i = 1;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
102 while (i <= nargin)
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
103 arg = varargin{i++};
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
104 if (ischar (arg))
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
105 switch (tolower (arg))
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
106 case "peer"
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
107 if (i > nargin)
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
108 error ('colorbar: missing axes handle after "peer"');
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
109 else
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
110 ax = varargin{i++};
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
111 if (! isscalar (ax) || ! ishandle (ax)
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
112 || ! strcmp (get (ax, "type"), "axes"))
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
113 error ('colorbar: expecting an axes handle following "peer"');
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
114 endif
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
115 endif
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
116 case {"north", "south", "east", "west",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
117 "northoutside", "southoutside", "eastoutside", "westoutside"}
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
118 loc = tolower (arg);
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
119 case "location"
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
120 if (i > nargin)
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
121 error ('colorbar: missing value after "location"');
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
122 else
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
123 loc = tolower (varargin{i++});
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
124 endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
125 case {"delete", "hide", "off", "none"}
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
126 deleting = true;
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
127 otherwise
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
128 args{end+1} = arg;
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
129 endswitch
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
130 else
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
131 args{end+1} = arg;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
132 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
133 endwhile
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
134
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
135 ## Handle changes to existing colorbar
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
136 if (! isempty (hcb))
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
137 if (deleting)
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
138 delete (hcb);
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
139 if (nargout > 0)
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
140 h = hcb;
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
141 endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
142 return;
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
143 else
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
144 ## FIXME: No listener on location property so have to re-create
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
145 ## colorbar whenever an option changes.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
146 ## re-instate this code if listener is developed.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
147 # if (! isempty (loc))
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
148 # set (hcb, "location", loc);
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
149 # endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
150 # if (! isempty (args))
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
151 # set (hcb, args{:});
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
152 # endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
153 ax = get (get (hcb, "parent"), "currrentaxes");
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
154 endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
155 endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
156
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
157 if (isempty (loc))
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
158 loc = "eastoutside";
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
159 endif
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
160 if (isempty (ax))
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
161 ax = gca ();
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
162 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
163
8892
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
164 showhiddenhandles = get (0, "showhiddenhandles");
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
165 unwind_protect
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
166 set (0, "showhiddenhandles", "on");
8892
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
167 cax = findobj (get (ax, "parent"), "tag", "colorbar", "type", "axes", "axes", ax);
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
168 if (! isempty (cax))
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
169 delete (cax);
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
170 endif
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
171 unwind_protect_cleanup
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
172 set (0, "showhiddenhandles", showhiddenhandles);
8892
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
173 end_unwind_protect
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
174
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
175 if (! deleting)
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
176 ## FIXME: Matlab does not require the "position" property to be active.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
177 ## Is there a way to determine the plotbox position for the
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
178 ## gnuplot graphics toolkit with the outerposition is active?
10931
a72d53df4fa6 Treatment of activepositionproperty for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10920
diff changeset
179 set (ax, "activepositionproperty", "position");
8892
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
180 obj = get (ax);
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
181 obj.__cbar_hax__ = ax;
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
182 position = obj.position;
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
183 ## FIXME: Should this be ancestor to accommodate hggroups?
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
184 hpar = get (ax, "parent");
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
185 clen = rows (get (hpar, "colormap"));
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
186 cext = get (ax, "clim");
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
187 cdiff = (cext(2) - cext(1)) / clen / 2;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
188 cmin = cext(1) + cdiff;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
189 cmax = cext(2) - cdiff;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
190
10532
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
191 [pos, cpos, vertical, mirror] = ...
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
192 __position_colorbox__ (loc, obj, ancestor (ax, "figure"));
10931
a72d53df4fa6 Treatment of activepositionproperty for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10920
diff changeset
193 set (ax, "position", pos);
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
194
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
195 cax = __go_axes__ (hpar, "tag", "colorbar",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
196 "handlevisibility", "on",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
197 "activepositionproperty", "position",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
198 "position", cpos);
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
199 addproperty ("location", cax, "radio",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
200 "eastoutside|east|westoutside|west|northoutside|north|southoutside|south",
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
201 loc);
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
202 addproperty ("axes", cax, "handle", ax);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
203
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
204 if (vertical)
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
205 hi = image (cax, [0,1], [cmin, cmax], [1 : clen]');
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
206 if (mirror)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
207 set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
208 "ylim", cext, "ylimmode", "manual",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
209 "yaxislocation", "right", args{:});
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
210 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
211 set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
212 "ylim", cext, "ylimmode", "manual",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
213 "yaxislocation", "left", args{:});
8101
86955a1559c5 improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents: 7726
diff changeset
214 endif
86955a1559c5 improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents: 7726
diff changeset
215 else
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
216 hi = image (cax, [cmin, cmax], [0,1], [1 : clen]);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
217 if (mirror)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
218 set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
219 "xlim", cext, "xlimmode", "manual",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
220 "xaxislocation", "top", args{:});
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
221 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
222 set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
223 "xlim", cext, "xlimmode", "manual",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
224 "xaxislocation", "bottom", args{:});
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
225 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
226 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
227
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
228 ## Dummy object placed in axis to delete colorbar when axis is deleted.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
229 ctext = text (0, 0, "", "tag", "colorbar",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
230 "visible", "off", "handlevisibility", "off",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
231 "xliminclude", "off", "yliminclude", "off",
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
232 "zliminclude", "off",
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
233 "deletefcn", {@deletecolorbar, cax, obj});
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
234
14777
1230d5d58d2d Fix segfault when replacing a colorbar axis. (Bug # 36576)
Ben Abbott <bpabbott@mac.com>
parents: 14363
diff changeset
235 set (cax, "deletefcn", {@resetaxis, ax, obj});
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
236
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
237 addlistener (hpar, "colormap", {@update_colorbar_cmap, hi, vertical, clen});
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
238 addlistener (ax, "clim", {@update_colorbar_clim, hi, vertical});
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
239 addlistener (ax, "dataaspectratio", {@update_colorbar_axis, cax, obj});
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
240 addlistener (ax, "dataaspectratiomode", {@update_colorbar_axis, cax, obj});
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
241 addlistener (ax, "plotboxaspectratio", {@update_colorbar_axis, cax, obj});
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
242 addlistener (ax, "plotboxaspectratiomode", {@update_colorbar_axis, cax, obj});
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
243 addlistener (ax, "position", {@update_colorbar_axis, cax, obj});
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
244
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
245 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
246
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
247 if (nargout > 0)
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
248 h = cax;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
249 endif
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
250
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
251 endfunction
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
252
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
253 function deletecolorbar (h, d, hc, orig_props)
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
254 ## Don't delete the colorbar and reset the axis size if the
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
255 ## parent figure is being deleted.
11149
fe3c3dfc07eb style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents: 11001
diff changeset
256 if (ishandle (hc) && strcmp (get (hc, "type"), "axes")
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
257 && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
258 if (strcmp (get (hc, "beingdeleted"), "off"))
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
259 delete (hc);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
260 endif
11149
fe3c3dfc07eb style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents: 11001
diff changeset
261 if (!isempty (ancestor (h, "axes"))
fe3c3dfc07eb style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents: 11001
diff changeset
262 && strcmp (get (ancestor (h, "axes"), "beingdeleted"), "off"))
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
263 ax = ancestor (h, "axes");
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
264 units = get (ax, "units");
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
265 set (ax, "units", orig_props.units);
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
266 set (ancestor (h, "axes"), "position", orig_props.position,
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
267 "outerposition", orig_props.outerposition,
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
268 "activepositionproperty", orig_props.activepositionproperty);
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
269 set (ax, "units", units);
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
270 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
271 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
272 endfunction
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
273
14777
1230d5d58d2d Fix segfault when replacing a colorbar axis. (Bug # 36576)
Ben Abbott <bpabbott@mac.com>
parents: 14363
diff changeset
274 function resetaxis (cax, d, ax, orig_props)
1230d5d58d2d Fix segfault when replacing a colorbar axis. (Bug # 36576)
Ben Abbott <bpabbott@mac.com>
parents: 14363
diff changeset
275 if (ishandle (ax) && strcmp (get (ax, "type"), "axes"))
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
276 ## FIXME: Probably don't want to delete everyone's listeners on colormap.
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
277 dellistener (get (ax, "parent"), "colormap");
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
278 dellistener (ax, "clim");
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
279 dellistener (ax, "dataaspectratio");
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
280 dellistener (ax, "dataaspectratiomode");
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
281 dellistener (ax, "plotboxaspectratio");
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
282 dellistener (ax, "plotboxaspectratiomode");
15202
f3b5cadfd6d5 fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents: 14868
diff changeset
283 dellistener (ax, "position");
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
284
14777
1230d5d58d2d Fix segfault when replacing a colorbar axis. (Bug # 36576)
Ben Abbott <bpabbott@mac.com>
parents: 14363
diff changeset
285 units = get (ax, "units");
15202
f3b5cadfd6d5 fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents: 14868
diff changeset
286 set (ax, "units", orig_props.units);
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
287 set (ax, "position", orig_props.position,
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
288 "outerposition", orig_props.outerposition,
14777
1230d5d58d2d Fix segfault when replacing a colorbar axis. (Bug # 36576)
Ben Abbott <bpabbott@mac.com>
parents: 14363
diff changeset
289 "activepositionproperty", orig_props.activepositionproperty);
15202
f3b5cadfd6d5 fix missing semicolons in various .m files
John W. Eaton <jwe@octave.org>
parents: 14868
diff changeset
290 set (ax, "units", units);
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
291 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
292 endfunction
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
293
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
294 function update_colorbar_clim (hax, d, hi, vert)
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
295 if (ishandle (hax) && strcmp (get (hax, "type"), "axes")
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
296 && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
297 clen = rows (get (get (hax, "parent"), "colormap"));
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
298 cext = get (hax, "clim");
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
299 cdiff = (cext(2) - cext(1)) / clen / 2;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
300 cmin = cext(1) + cdiff;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
301 cmax = cext(2) - cdiff;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
302
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
303 if (vert)
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
304 set (hi, "ydata", [cmin, cmax]);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
305 set (get (hi, "parent"), "ylim", cext);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
306 else
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
307 set (hi, "xdata", [cmin, cmax]);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
308 set (get (hi, "parent"), "xlim", cext);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
309 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
310 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
311 endfunction
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
312
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
313 function update_colorbar_cmap (hf, d, hi, vert, init_sz)
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
314 persistent sz = init_sz;
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
315
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
316 if (ishandle (hf) && strcmp (get (hf, "type"), "figure")
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
317 && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"), "off")))
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
318 clen = rows (get (hf, "colormap"));
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
319 if (clen != sz)
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
320 if (vert)
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
321 set (hi, "cdata", [1:clen]');
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
322 else
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
323 set (hi, "cdata", [1:clen]);
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
324 endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
325 sz = clen;
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
326 ## Also update limits on axis or there will be white gaps
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
327 update_colorbar_clim (get (hi, "parent"), d, hi, vert);
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
328 endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
329 endif
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
330 endfunction
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
331
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
332 function update_colorbar_axis (h, d, cax, orig_props)
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
333
11149
fe3c3dfc07eb style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents: 11001
diff changeset
334 if (ishandle (cax) && strcmp (get (cax, "type"), "axes")
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14777
diff changeset
335 && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")))
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
336 loc = get (cax, "location");
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
337 obj = get (h);
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
338 obj.__cbar_hax__ = h;
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
339 obj.position = orig_props.position;
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
340 obj.outerposition = orig_props.outerposition;
10532
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
341 [pos, cpos, vertical, mirror] = ...
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
342 __position_colorbox__ (loc, obj, ancestor (h, "figure"));
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
343
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
344 if (vertical)
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
345 if (mirror)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
346 set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
347 "yaxislocation", "right", "position", cpos);
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
348 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
349 set (cax, "xtick", [], "xdir", "normal", "ydir", "normal",
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
350 "yaxislocation", "left", "position", cpos);
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
351 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
352 else
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
353 if (mirror)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
354 set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
355 "xaxislocation", "top", "position", cpos);
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
356 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10534
diff changeset
357 set (cax, "ytick", [], "xdir", "normal", "ydir", "normal",
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
358 "xaxislocation", "bottom", "position", cpos);
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
359 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
360 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
361
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
362 endif
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
363 endfunction
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
364
10532
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
365 function [pos, cpos, vertical, mirr] = __position_colorbox__ (cbox, obj, cf)
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
366
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
367 ## This will always represent the position prior to adding the colorbar.
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
368 pos = obj.position;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
369 sz = pos(3:4);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
370
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
371 if (strcmp (obj.plotboxaspectratiomode, "manual")
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
372 || strcmp (obj.dataaspectratiomode, "manual"))
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
373 if (isempty (strfind (cbox, "outside")))
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
374 scale = 1.0;
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
375 else
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
376 scale = 0.8;
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
377 endif
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
378 if (isempty (strfind (cbox, "east")) && isempty (strfind (cbox, "west")))
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
379 scale = [1, scale];
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
380 else
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
381 scale = [scale, 1];
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
382 endif
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
383 if (strcmp (get (cf, "__graphics_toolkit__"), "gnuplot")
11001
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
384 && strcmp (obj.activepositionproperty, "outerposition"))
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
385 obj.outerposition = obj.outerposition .* [1, 1, scale];
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
386 off = 0.5 * (obj.outerposition (3:4) - __actual_axis_position__ (obj)(3:4));
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
387 else
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
388 obj.position = obj.position .* [1, 1, scale];
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
389 off = 0.5 * (obj.position (3:4) - __actual_axis_position__ (obj)(3:4));
2ab8cc6dcced Special treatment activepositionproperty = outerposition for gnuplot.
Ben Abbott <bpabbott@mac.com>
parents: 10953
diff changeset
390 endif
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
391 else
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
392 off = 0.0;
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
393 endif
8101
86955a1559c5 improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents: 7726
diff changeset
394
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
395 switch (cbox)
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
396 case "northoutside"
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
397 origin = pos(1:2) + [0., 0.9] .* sz + [1, -1] .* off;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
398 sz = sz .* [1.0, 0.06];
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
399 pos(4) = 0.8 * pos(4);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
400 mirr = true;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
401 vertical = false;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
402 case "north"
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
403 origin = pos(1:2) + [0.05, 0.9] .* sz + [1, -1] .* off;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
404 sz = sz .* [1.0, 0.06] * 0.9;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
405 mirr = false;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
406 vertical = false;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
407 case "southoutside"
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
408 origin = pos(1:2) + off;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
409 sz = sz .* [1.0, 0.06];
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
410 pos(2) = pos(2) + pos(4) * 0.2;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
411 pos(4) = 0.8 * pos(4);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
412 mirr = false;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
413 vertical = false;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
414 case "south"
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
415 origin = pos(1:2) + [0.05, 0.05] .* sz + off;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
416 sz = sz .* [1.0, 0.06] * 0.9;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
417 mirr = true;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
418 vertical = false;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
419 case "eastoutside"
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
420 origin = pos(1:2) + [0.9, 0] .* sz + [-1, 1] .* off;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
421 sz = sz .* [0.06, 1.0];
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
422 pos(3) = 0.8 * pos(3);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
423 mirr = true;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
424 vertical = true;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
425 case "east"
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
426 origin = pos(1:2) + [0.9, 0.05] .* sz + [-1, 1] .* off;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
427 sz = sz .* [0.06, 1.0] * 0.9;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
428 mirr = false;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
429 vertical = true;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
430 case "westoutside"
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
431 origin = pos(1:2) + off;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
432 sz = sz .* [0.06, 1.0];
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
433 pos(1) = pos(1) + pos(3) * 0.2;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
434 pos(3) = 0.8 * pos(3);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
435 mirr = false;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
436 vertical = true;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
437 case "west"
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
438 origin = pos(1:2) + [0.05, 0.05] .* sz + off;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
439 sz = sz .* [0.06, 1.0] .* 0.9;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
440 mirr = true;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
441 vertical = true;
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
442 endswitch
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
443
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
444 cpos = [origin, sz];
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
445
17100
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
446 if (strcmp (obj.plotboxaspectratiomode, "manual")
33037eddecd2 Overhaul colorbar function.
Rik <rik@octave.org>
parents: 15202
diff changeset
447 || strcmp (obj.dataaspectratiomode, "manual"))
10532
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
448 obj.position = pos;
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
449 actual_pos = __actual_axis_position__ (obj);
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
450 if (strfind (cbox, "outside"))
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
451 scale = 1.0;
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
452 else
10532
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
453 scale = 0.9;
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
454 endif
10532
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
455 if (sz(1) > sz(2))
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
456 ## Ensure north or south colorbars are the proper length
10532
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
457 dx = (1-scale)*actual_pos(3);
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
458 cpos(1) = actual_pos(1) + dx/2;
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
459 cpos(3) = actual_pos(3) - dx;
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
460 else
10558
23c1910dbd8e Fix colorbar() bugs for manual plotboxaspectratio.
Ben Abbott <bpabbott@mac.com>
parents: 10549
diff changeset
461 ## Ensure east or west colorbars are the proper height
10532
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
462 dy = (1-scale)*actual_pos(4);
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
463 cpos(2) = actual_pos(2) + dy/2;
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
464 cpos(4) = actual_pos(4) - dy;
568c7c041fac colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
Ben Abbott <bpabbott@mac.com>
parents: 10226
diff changeset
465 endif
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
466 endif
8101
86955a1559c5 improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents: 7726
diff changeset
467
86955a1559c5 improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents: 7726
diff changeset
468 endfunction
86955a1559c5 improve speed of cell2mat
David Bateman <dbateman@free.fr>
parents: 7726
diff changeset
469
7726
1b954fdaf4ff Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents: 7264
diff changeset
470
1b954fdaf4ff Try to get the colorbar position right for manual aspect ratios as well
David Bateman <dbateman@free.fr>
parents: 7264
diff changeset
471 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
472 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
473 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
474 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
475 %! imagesc (x);
8892
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
476 %! colorbar ();
32d218494602 colorbar.m: Bug fix. Allow hidden colorbars to be deleted, and replace existing colorbar when a new one is created. Additional demos are included to verify these behaviors.
Ben Abbott <bpabbott@mac.com>
parents: 8889
diff changeset
477
9281
02b16eeb3167 Fix yticklabels for log scale colorbar.
Ben Abbott <bpabbott@mac.com>
parents: 9262
diff changeset
478 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
479 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
480 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
481 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
482 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
483 %! colorbar ('westoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
484
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
485 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
486 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
487 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
488 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
489 %! imagesc (x);
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14247
diff changeset
490 %! colorbar ('peer', gca, 'northoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
491
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
492 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
493 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
494 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
495 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
496 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
497 %! colorbar ('southoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
498
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
499 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
500 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
501 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
502 %! contour (peaks ());
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
503 %! colorbar ('west');
9281
02b16eeb3167 Fix yticklabels for log scale colorbar.
Ben Abbott <bpabbott@mac.com>
parents: 9262
diff changeset
504
02b16eeb3167 Fix yticklabels for log scale colorbar.
Ben Abbott <bpabbott@mac.com>
parents: 9262
diff changeset
505 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
506 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
507 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
508 %! subplot (2,2,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
509 %! contour (peaks ());
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
510 %! colorbar ('east');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
511 %! subplot (2,2,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
512 %! contour (peaks ());
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
513 %! colorbar ('west');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
514 %! subplot (2,2,3);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
515 %! contour (peaks ());
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
516 %! colorbar ('north');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
517 %! subplot (2,2,4);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
518 %! contour (peaks ());
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
519 %! colorbar ('south');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
520
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
521 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
522 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
523 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
524 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
525 %! subplot (2,2,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
526 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
527 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
528 %! subplot (2,2,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
529 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
530 %! colorbar ('westoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
531 %! subplot (2,2,3);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
532 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
533 %! colorbar ('northoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
534 %! subplot (2,2,4);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
535 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
536 %! colorbar ('southoutside');
9281
02b16eeb3167 Fix yticklabels for log scale colorbar.
Ben Abbott <bpabbott@mac.com>
parents: 9262
diff changeset
537
9297
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
538 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
539 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
540 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
541 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
542 %! subplot (1,2,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
543 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
544 %! axis square;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
545 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
546 %! subplot (1,2,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
547 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
548 %! axis square;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
549 %! colorbar ('westoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
550
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
551 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
552 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
553 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
554 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
555 %! subplot (1,2,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
556 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
557 %! axis square;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
558 %! colorbar ('northoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
559 %! subplot (1,2,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
560 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
561 %! axis square;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
562 %! colorbar ('southoutside');
9297
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
563
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
564 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
565 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
566 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
567 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
568 %! subplot (2,1,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
569 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
570 %! axis square;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
571 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
572 %! subplot (2,1,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
573 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
574 %! axis square;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
575 %! colorbar ('westoutside');
9297
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
576
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
577 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
578 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
579 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
580 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
581 %! subplot (2,1,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
582 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
583 %! axis square;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
584 %! colorbar ('northoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
585 %! subplot (2,1,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
586 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
587 %! axis square;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
588 %! colorbar ('southoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
589
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
590 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
591 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
592 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
593 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
594 %! subplot (1,2,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
595 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
596 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
597 %! subplot (1,2,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
598 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
599 %! colorbar ('westoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
600
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
601 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
602 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
603 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
604 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
605 %! subplot (1,2,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
606 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
607 %! colorbar ('northoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
608 %! subplot (1,2,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
609 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
610 %! colorbar ('southoutside');
9297
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
611
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
612 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
613 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
614 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
615 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
616 %! subplot (2,1,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
617 %! imagesc (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
618 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
619 %! subplot (2,1,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
620 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
621 %! colorbar ('westoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
622
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
623 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
624 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
625 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
626 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
627 %! subplot (2,1,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
628 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
629 %! colorbar ('northoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
630 %! subplot (2,1,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
631 %! imagesc (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
632 %! colorbar ('southoutside');
9297
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
633
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
634 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
635 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
636 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
637 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
638 %! subplot (1,2,1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
639 %! contour (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
640 %! axis square;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
641 %! colorbar ('east');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
642 %! xlim ([1, 64]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
643 %! ylim ([1, 64]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
644 %! subplot (1,2,2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
645 %! contour (x);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
646 %! colorbar ('west');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
647 %! xlim ([1, 64]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
648 %! ylim ([1, 64]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
649
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
650 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
651 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
652 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
653 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
654 %! contour (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
655 %! xlim ([1, 64]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
656 %! ylim ([1, 64]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
657 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
658 %! colorbar off;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
659
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
660 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
661 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
662 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
663 %! n = 64; x = kron (1:n, ones (n,1)); x = abs (x - x.');
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
664 %! contour (x);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
665 %! xlim ([1, 64]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
666 %! ylim ([1, 64]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
667 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
668
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
669 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
670 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
671 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
672 %! imagesc (1 ./ hilb (99));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
673 %! h = colorbar ();
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
674 %! set (h, 'yscale', 'log');
9297
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
675
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
676 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
677 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
678 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
679 %! imagesc (log10 (1 ./ hilb (99)));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
680 %! h = colorbar ();
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
681 %! ytick = get (h, 'ytick');
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
682 %! set (h, 'yticklabel', sprintf ('10^{%g}|', ytick));
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
683
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
684 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
685 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
686 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
687 %! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
688 %! imagesc (1 ./ hilb (n));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
689 %! axis equal;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
690 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
691
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
692 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
693 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
694 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
695 %! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
696 %! imagesc (x, y, 1 ./ hilb (n));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
697 %! axis equal;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
698 %! colorbar ();
9297
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
699
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
700 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
701 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
702 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
703 %! n = 5; x = linspace (0,5,n); y = linspace (0,1,n);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
704 %! imagesc (y, x, 1 ./ hilb (n));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
705 %! axis equal;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
706 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
707
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
708 ## This requires that the axes position be properly determined for 'axis equal'
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
709 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
710 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
711 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
712 %! axes;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
713 %! colorbar ();
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
714 %! hold on;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
715 %! contour (peaks ());
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
716 %! hold off;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
717
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
718 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
719 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
720 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
721 %! plot ([0, 2]);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
722 %! colorbar ('east');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
723 %! axis square;
10910
40cf7cc4ea62 Properly interpret plotboxaspectratio when 3D objects are viewed as 2D.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
724
40cf7cc4ea62 Properly interpret plotboxaspectratio when 3D objects are viewed as 2D.
Ben Abbott <bpabbott@mac.com>
parents: 10821
diff changeset
725 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
726 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
727 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
728 %! plot ([0, 2]);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
729 %! colorbar ('eastoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
730 %! axis square;
9297
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
731
0d9f925b9705 colorbar.m: Colorbar 'handlevisibility' should be 'on'. Add additional demos which illustrate problems with the present implementation.
Ben Abbott <bpabbott@mac.com>
parents: 9281
diff changeset
732 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
733 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
734 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
735 %! pcolor (peaks (20));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
736 %! shading interp;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
737 %! axis ('tight', 'square');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
738 %! colorbar ();
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
739 #%! axes ('color','none','box','on','activepositionproperty','position');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
740
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
741 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
742 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
743 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
744 %! plot ([0, 2]);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
745 %! colorbar ('east');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
746 %! axis equal;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
747
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
748 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
749 %! clf;
14247
c4fa5e0b6193 test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents: 14245
diff changeset
750 %! colormap ('default');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
751 %! plot ([0, 2]);
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
752 %! colorbar ('eastoutside');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
753 %! axis equal;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
754