annotate scripts/plot/copyobj.m @ 17122: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 84db9338c448
children e7723410ec32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
1 ## Copyright (C) 2012 pdiribarne
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
2 ##
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
3 ## This program is free software; you can redistribute it and/or modify
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
4 ## it under the terms of the GNU General Public License as published by
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
5 ## the Free Software Foundation; either version 3 of the License, or
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
6 ## (at your option) any later version.
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
7 ##
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
8 ## This program is distributed in the hope that it will be useful,
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
11 ## GNU General Public License for more details.
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
12 ##
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
13 ## You should have received a copy of the GNU General Public License
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
14 ## along with Octave; see the file COPYING. If not, see
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
15 ## <http://www.gnu.org/licenses/>.
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
16
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
17 ## -*- texinfo -*-
15007
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
18 ## @deftypefn {Function File} {@var{hnew} =} copyobj (@var{horig})
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
19 ## @deftypefnx {Function File} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17006
diff changeset
20 ## Construct a copy of the graphic object associated with handle @var{horig}
15007
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
21 ## and return a handle @var{hnew} to the new object.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17006
diff changeset
22 ##
15007
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
23 ## If a parent handle @var{hparent} (root, figure, axes, or hggroup) is
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17006
diff changeset
24 ## specified, the copied object will be created as a child of @var{hparent}.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17006
diff changeset
25 ## @seealso{struct2hdl, hdl2struct, findobj}
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
26 ## @end deftypefn
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
27
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
28 ## Author: pdiribarne <pdiribarne@new-host.home>
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
29 ## Created: 2012-04-01
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
30
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
31 function hnew = copyobj (horig, hparent = 0)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
32
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
33 partypes = {"root", "figure", "axes", "hggroup"};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
34 othertypes = {"line", "patch", "surface", "image", "text"};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
35 alltypes = [partypes othertypes];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
36
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
37 if (! ishandle (horig) || nargin > 2)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
38 print_usage ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
39 elseif (! ishandle (hparent))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
40 hparent = figure (fix (hparent));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
41 elseif (! any (strcmpi (get (hparent).type, partypes)))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
42 print_usage ();
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
43 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
44
15710
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
45 ## current figure and axes
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
46 cf = gcf ();
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
47 ca = gca ();
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
48
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
49 ## compatibility of input handles
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
50 kididx = find (strcmp (alltypes, get (horig).type));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
51 paridx = find (strcmp (alltypes, get (hparent).type));
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
52
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
53 if (kididx <= paridx)
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
54 error ("copyobj: %s object can't be children to %s.",
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
55 alltypes{kididx}, alltypes{paridx});
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
56 elseif (nargin == 1)
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
57 str = hdl2struct (horig);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
58 hnew = struct2hdl (str);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
59 else
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
60 str = hdl2struct (horig);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
61 hnew = struct2hdl (str, hparent);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
62 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
63
15710
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
64 ## reset current figure (and eventually axes) to original
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
65 set (0, "currentfigure", cf);
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
66 if (get (hnew, "parent") == cf)
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
67 set (cf, "currentaxes", ca)
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
68 endif
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
69
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
70 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
71
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
72
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
73 %!demo
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
74 %! hdl = figure (1234);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
75 %! clf;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
76 %! hold on;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
77 %! x = 1:10;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
78 %! y = x.^2;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
79 %! dy = 2 * (.2 * x);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
80 %! y2 = (x - 3).^2;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
81 %! hg = errorbar (x, y, dy,'#~');
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
82 %! set (hg, 'marker', '^', 'markerfacecolor', rand (1,3));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
83 %! plot (x, y2, 'ok-');
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
84 %! legend ('errorbar', 'line');
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
85 %! hnew = copyobj (hdl);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
86
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
87 %!demo
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
88 %! ## FIXME: This demo fails occasionally for an obscure reason.
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
89 %! ## It appears that there is something wrong with Octave code for patches.
17006
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
90 %! try
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
91 %! hdl = figure (1234);
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
92 %! clf;
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
93 %! subplot (2,2,1);
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
94 %! hold on;
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
95 %! contourf (rand (10, 10));
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
96 %! colorbar;
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
97 %! subplot (2,2,2);
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
98 %! quiver (rand (10, 10), rand (10, 10));
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
99 %! subplot (2,2,3);
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
100 %! colormap (jet (64));
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
101 %! hold on;
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
102 %! sombrero;
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
103 %! colorbar ('peer', gca, 'NorthOutside');
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
104 %! subplot (2,2,4);
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
105 %! imagesc (rand (30, 30));
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
106 %! text (15, 15, 'Rotated text', ...
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
107 %! 'HorizontAlalignment', 'Center', 'Rotation', 30);
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
108 %! hnew = copyobj (hdl);
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
109 %! catch
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
110 %! close all
84db9338c448 Modify copyobj() demo to close non-responsive figure window.
Ben Abbott <bpabbott@mac.com>
parents: 15710
diff changeset
111 %! end
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
112
15328
efbc896c1ecc Disable tests calling imread if not using GraphicsMagick
Mike Miller <mtmiller@ieee.org>
parents: 15011
diff changeset
113 %!testif HAVE_MAGICK
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
114 %! h1 = figure ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
115 %! set (h1, "visible", "off");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
116 %! x = 0:0.1:2*pi;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
117 %! y1 = sin (x);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
118 %! y2 = exp (x - 1);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
119 %! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
120 %! xlabel ("X");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
121 %! ylabel (ax(1), "Axis 1");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
122 %! ylabel (ax(2), "Axis 2");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
123 %! axes (ax(1));
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
124 %! text (0.5, 0.5, "Left Axis", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
125 %! "color", [0 0 1], "horizontalalignment", "center");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
126 %! axes (ax(2));
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
127 %! text (4.5, 80, "Right Axis", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
128 %! "color", [0 0.5 0], "horizontalalignment", "center");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
129 %! s1 = hdl2struct (h1);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
130 %! h2 = struct2hdl (s1);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
131 %! s2 = hdl2struct (h2);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
132 %! png1 = strcat (tmpnam (), ".png");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
133 %! png2 = strcat (tmpnam (), ".png");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
134 %! unwind_protect
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
135 %! print (h1, png1);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
136 %! [img1, map1, alpha1] = imread (png1);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
137 %! print (h2, png2);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
138 %! [img2, map2, alpha2] = imread (png2);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
139 %! unwind_protect_cleanup
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
140 %! unlink (png1);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
141 %! unlink (png2);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
142 %! end_unwind_protect
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
143 %! assert (img1, img2);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
144 %! assert (map1, map2);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
145 %! assert (alpha1, alpha2);