annotate scripts/plot/draw/plotyy.m @ 28310:1379ebcb00c3

Replace uses of axes property "activepositionproperty" by "positionconstraint" (bug #58336). * appearance/daspect.m, appearance/private/__gnuplot_legend__.m, draw/colorbar.m, draw/plotyy.m, draw/semilogx.m, draw/semilogy.m, util/__actual_axis_position__.m, util/private/__gnuplot_draw_axes__.m, util/struct2hdl.m, util/subplot.m: Replace all uses of axes property "activepositionproperty" (which is a hidden property now) by "positionconstraint". * graphics.in.h: Remove FIXME note.
author Markus Mützel <markus.muetzel@gmx.de>
date Mon, 18 May 2020 13:02:20 +0200
parents bd51beb6205e
children f3200b8cff19
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
3 ## Copyright (C) 2007-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27750
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
7 ##
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
8 ## This file is part of Octave.
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24432
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24432
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22622
diff changeset
13 ## (at your option) any later version.
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
14 ##
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22622
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22622
diff changeset
18 ## GNU General Public License for more details.
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
19 ##
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24432
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
25
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19712
diff changeset
27 ## @deftypefn {} {} plotyy (@var{x1}, @var{y1}, @var{x2}, @var{y2})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19712
diff changeset
28 ## @deftypefnx {} {} plotyy (@dots{}, @var{fun})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19712
diff changeset
29 ## @deftypefnx {} {} plotyy (@dots{}, @var{fun1}, @var{fun2})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19712
diff changeset
30 ## @deftypefnx {} {} plotyy (@var{hax}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19712
diff changeset
31 ## @deftypefnx {} {[@var{ax}, @var{h1}, @var{h2}] =} plotyy (@dots{})
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
32 ## Plot two sets of data with independent y-axes and a common x-axis.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17068
diff changeset
33 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17068
diff changeset
34 ## The arguments @var{x1} and @var{y1} define the arguments for the first plot
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17068
diff changeset
35 ## and @var{x1} and @var{y2} for the second.
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
36 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
37 ## By default the arguments are evaluated with
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
38 ## @code{feval (@@plot, @var{x}, @var{y})}. However the type of plot can be
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
39 ## modified with the @var{fun} argument, in which case the plots are
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
40 ## generated by @code{feval (@var{fun}, @var{x}, @var{y})}. @var{fun} can be
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17068
diff changeset
41 ## a function handle, an inline function, or a string of a function name.
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
42 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
43 ## The function to use for each of the plots can be independently defined
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
44 ## with @var{fun1} and @var{fun2}.
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
45 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17068
diff changeset
46 ## If the first argument @var{hax} is an axes handle, then it defines
24431
0c6cedafc71e doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents: 24292
diff changeset
47 ## the principal axes in which to plot the @var{x1} and @var{y1} data.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17068
diff changeset
48 ##
24431
0c6cedafc71e doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents: 24292
diff changeset
49 ## The return value @var{ax} is a vector with the axes handles of the two
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
50 ## y-axes. @var{h1} and @var{h2} are handles to the objects generated by the
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17068
diff changeset
51 ## plot commands.
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
52 ##
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
53 ## @example
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
54 ## @group
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
55 ## x = 0:0.1:2*pi;
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
56 ## y1 = sin (x);
7196
9092375e3936 [project @ 2007-11-26 23:39:26 by jwe]
jwe
parents: 7195
diff changeset
57 ## y2 = exp (x - 1);
9092375e3936 [project @ 2007-11-26 23:39:26 by jwe]
jwe
parents: 7195
diff changeset
58 ## ax = plotyy (x, y1, x - 1, y2, @@plot, @@semilogy);
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
59 ## xlabel ("X");
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
60 ## ylabel (ax(1), "Axis 1");
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
61 ## ylabel (ax(2), "Axis 2");
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
62 ## @end group
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
63 ## @end example
16814
64e7bb01fce2 doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents: 15202
diff changeset
64 ## @seealso{plot}
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
65 ## @end deftypefn
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
66
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
67 function [ax, h1, h2] = plotyy (varargin)
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
68
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
69 [hax, varargin] = __plt_get_axis_arg__ ("plotyy", varargin{:});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
70
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
71 nargin = numel (varargin);
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
72 if (nargin < 4 || nargin > 6)
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
73 print_usage ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
74 endif
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
75
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
76 oldfig = [];
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
77 if (! isempty (hax))
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
78 oldfig = get (0, "currentfigure");
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
79 endif
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
80 unwind_protect
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
81 hax = newplot (hax);
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
82
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
83 ## FIXME: Second conditional test shouldn't be required.
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
84 ## 'cla reset' needs to delete user properties like __plotyy_axes__.
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
85 if (isprop (hax, "__plotyy_axes__")
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
86 && isaxes (get (hax, "__plotyy_axes__")) == [true; true])
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
87 hax = get (hax, "__plotyy_axes__");
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
88 else
27750
597e50809a9c plotyy.m: Fix incorrect parenting of second axes object (bug #57313)
Rik <rik@octave.org>
parents: 27708
diff changeset
89 hax = [hax; axes("nextplot", get (hax(1), "nextplot"), ...
597e50809a9c plotyy.m: Fix incorrect parenting of second axes object (bug #57313)
Rik <rik@octave.org>
parents: 27708
diff changeset
90 "parent", get(hax(1), "parent"))];
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
91 endif
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
92
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
93 [axtmp, h1tmp, h2tmp] = __plotyy__ (hax, varargin{:});
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
94
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
95 set (gcf, "currentaxes", hax(1));
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
96
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
97 unwind_protect_cleanup
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
98 if (! isempty (oldfig))
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
99 set (0, "currentfigure", oldfig);
8237
52f2fba4f3f8 Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents: 8208
diff changeset
100 endif
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
101 end_unwind_protect
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
102
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
103 if (nargout > 0)
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
104 ax = axtmp;
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
105 h1 = h1tmp;
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
106 h2 = h2tmp;
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
107 endif
7196
9092375e3936 [project @ 2007-11-26 23:39:26 by jwe]
jwe
parents: 7195
diff changeset
108
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
109 endfunction
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
110
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
111 function [ax, h1, h2] = __plotyy__ (ax, x1, y1, x2, y2, fun1 = @plot, fun2)
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
112
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
113 if (nargin < 7)
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
114 fun2 = fun1;
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
115 endif
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
116
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
117 xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])];
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
118
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
119 axes (ax(1));
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
120
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
121 h1 = feval (fun1, x1, y1);
7220
66081694ffb8 [project @ 2007-11-29 23:14:07 by jwe]
jwe
parents: 7216
diff changeset
122
24294
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
123 set (ax(1), "xlim", xlim);
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
124 if (isscalar (h1))
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
125 ## Coloring y-axis only makes sense if plot contains exactly one line
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
126 set (ax(1), "ycolor", getcolor (h1));
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
127 endif
8237
52f2fba4f3f8 Test that an axis handle actually is one before setting it in plotyy
David Bateman <dbateman@free.fr>
parents: 8208
diff changeset
128
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
129 set (gcf (), "nextplot", "add");
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
130
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
131 axes (ax(2));
7665
aead4b9d026b Fix axis handle treatment in plotyy
David Bateman <dbateman@free.fr>
parents: 7314
diff changeset
132
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
133 colors = get (ax(1), "colororder");
26053
6250060e9e04 plotyy.m: Fix axis coloring when multiple line objects are present (bug #55002).
A.R. Burgers <arburgers@gmail.com>
parents: 25054
diff changeset
134 set (ax(2), "colororder", circshift (colors, -numel (h1), 1));
7195
97d2da8ed746 [project @ 2007-11-26 23:13:40 by dbateman]
dbateman
parents:
diff changeset
135
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22323
diff changeset
136 if (strcmp (get (ax(1), "__autopos_tag__"), "subplot"))
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22323
diff changeset
137 set (ax(2), "__autopos_tag__", "subplot");
27708
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
138 elseif (strcmp (graphics_toolkit (), "gnuplot"))
28310
1379ebcb00c3 Replace uses of axes property "activepositionproperty" by "positionconstraint" (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
139 set (ax, "positionconstraint", "innerposition");
12685
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12575
diff changeset
140 else
28310
1379ebcb00c3 Replace uses of axes property "activepositionproperty" by "positionconstraint" (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
141 set (ax, "positionconstraint", "outerposition");
12685
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12575
diff changeset
142 endif
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12575
diff changeset
143
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
144 ## Don't replace axis which has colororder property already modified
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
145 if (strcmp (get (ax(1), "nextplot"), "replace"))
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
146 set (ax(2), "nextplot", "replacechildren");
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
147 endif
24292
e24bf08dc559 plotyy.m: Fix error when using FUN2 argument (bug #48115)
Rik <rik@octave.org>
parents: 23219
diff changeset
148 h2 = feval (fun2, x2, y2);
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
149
24294
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
150 set (ax(2), "yaxislocation", "right", "color", "none", "box", "off",
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
151 "xlim", xlim);
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
152 if (isscalar (h2))
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
153 ## Coloring y-axis only makes sense if plot contains exactly one line
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
154 set (ax(2), "ycolor", getcolor (h2));
8a89878ac8bc plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
Rik <rik@octave.org>
parents: 24293
diff changeset
155 endif
12685
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12575
diff changeset
156
28310
1379ebcb00c3 Replace uses of axes property "activepositionproperty" by "positionconstraint" (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
157 if (strcmp (get(ax(1), "positionconstraint"), "innerposition"))
12685
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12575
diff changeset
158 set (ax(2), "position", get (ax(1), "position"));
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12575
diff changeset
159 else
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
160 set (ax(2), {"outerposition", "looseinset"},
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
161 get (ax(1), {"outerposition", "looseinset"}));
12685
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12575
diff changeset
162 endif
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12575
diff changeset
163
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
164 ## Restore nextplot value by copying value from axis #1
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
165 set (ax(2), "nextplot", get (ax(1), "nextplot"));
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
166
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
167 ## Add invisible text objects that when destroyed,
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
168 ## also remove the other axis
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
169 t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy",
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
170 "visible", "off", "handlevisibility", "off",
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
171 "xliminclude", "off", "yliminclude", "off",
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
172 "zliminclude", "off");
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
173
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
174 t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy",
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
175 "visible", "off", "handlevisibility", "off",
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
176 "xliminclude", "off", "yliminclude", "off",
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
177 "zliminclude", "off");
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
178
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
179 set (t1, "deletefcn", {@deleteplotyy, ax(2), t2});
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
180 set (t2, "deletefcn", {@deleteplotyy, ax(1), t1});
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
181
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
182 ## Add cross-listeners so a change in one axes' attributes updates the other.
27708
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
183 props = {"units", "looseinset", "position", "xlim", "view", ...
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
184 "plotboxaspectratio", "plotboxaspectratiomode", "nextplot"};
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
185
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
186 for ii = 1:numel (props)
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
187 addlistener (ax(1), props{ii}, {@update_prop, ax(2), props{ii}});
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
188 addlistener (ax(2), props{ii}, {@update_prop, ax(1), props{ii}});
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
189 endfor
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
190
9349
93664cbb732c plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents: 9346
diff changeset
191 ## Store the axes handles for the sister axes.
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
192 if (! isprop (ax(1), "__plotyy_axes__"))
19712
52cd69e79784 Fix legend function interaction with plotyy (bug #44246).
Rik <rik@octave.org>
parents: 19697
diff changeset
193 addproperty ("__plotyy_axes__", ax(1), "data");
52cd69e79784 Fix legend function interaction with plotyy (bug #44246).
Rik <rik@octave.org>
parents: 19697
diff changeset
194 set (ax(1), "__plotyy_axes__", ax);
13216
434e227b100b Improvements to plotyy.
Ben Abbott <bpabbott@mac.com>
parents: 13130
diff changeset
195 else
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
196 set (ax(1), "__plotyy_axes__", ax);
13216
434e227b100b Improvements to plotyy.
Ben Abbott <bpabbott@mac.com>
parents: 13130
diff changeset
197 endif
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
198 if (! isprop (ax(2), "__plotyy_axes__"))
19712
52cd69e79784 Fix legend function interaction with plotyy (bug #44246).
Rik <rik@octave.org>
parents: 19697
diff changeset
199 addproperty ("__plotyy_axes__", ax(2), "data");
52cd69e79784 Fix legend function interaction with plotyy (bug #44246).
Rik <rik@octave.org>
parents: 19697
diff changeset
200 set (ax(2), "__plotyy_axes__", ax);
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24426
diff changeset
201 else
10950
c9786e03670c Don't create __plotyy_axes__ properties in plotyy if they exist (Bug #30977)
David Bateman <dbateman@free.fr>
parents: 10949
diff changeset
202 set (ax(2), "__plotyy_axes__", ax);
13216
434e227b100b Improvements to plotyy.
Ben Abbott <bpabbott@mac.com>
parents: 13130
diff changeset
203 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
204
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
205 endfunction
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
206
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
207 function deleteplotyy (h, ~, ax2, t2)
24426
a51497205f4c Change uses of gcbf after Matlab compatibility change in bug #52621.
Rik <rik@octave.org>
parents: 24423
diff changeset
208 if (isaxes (ax2))
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
209 set (t2, "deletefcn", []);
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
210 delete (ax2);
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
211 endif
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
212 endfunction
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
213
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
214 function update_nextplot (h, ~, ax2)
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
215 persistent recursion = false;
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
216
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
217 if (! recursion)
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
218 unwind_protect
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
219 recursion = true;
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
220 set (ax2, "nextplot", get (h, "nextplot"));
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
221 unwind_protect_cleanup
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
222 recursion = false;
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
223 end_unwind_protect
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
224 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
225
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
226 endfunction
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
227
27708
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
228 function update_prop (h, ~, ax2, prop)
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
229 persistent recursion = false;
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
230 ## Don't allow recursion
27708
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
231 if (! recursion && all (ishghandle ([h, ax2])))
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
232 unwind_protect
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
233 recursion = true;
27708
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
234 val = get (h, prop);
c66467f74278 Rewrite legend (task #14243)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26553
diff changeset
235 set (ax2, prop, get (h, prop));
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
236 unwind_protect_cleanup
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
237 recursion = false;
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
238 end_unwind_protect
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
239 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
240
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
241 endfunction
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
242
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
243 function color = getcolor (ax)
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
244
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
245 obj = get (ax);
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
246 if (isfield (obj, "color"))
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
247 color = obj.color;
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
248 elseif (isfield (obj, "facecolor") && ! ischar (obj.facecolor))
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
249 color = obj.facecolor;
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
250 elseif (isfield (obj, "edgecolor") && ! ischar (obj.edgecolor))
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
251 color = obj.edgecolor;
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
252 else
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
253 color = [0, 0, 0];
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
254 endif
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
255
18344
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
256 endfunction
097202cbe564 plotyy.m: Overhaul function to use updated newplot().
Rik <rik@octave.org>
parents: 17744
diff changeset
257
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
258
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
259 %!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
260 %! clf;
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
261 %! x = 0:0.1:2*pi;
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
262 %! y1 = sin (x);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
263 %! y2 = exp (x - 1);
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
264 %! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21859
diff changeset
265 %! xlabel ("X");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21859
diff changeset
266 %! ylabel (ax(1), "Axis 1");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21859
diff changeset
267 %! ylabel (ax(2), "Axis 2");
26553
4744a878c43f plotyy.m, copyobj.m: Change %!demo code to run under Matlab (bug #55841).
Rik <rik@octave.org>
parents: 26376
diff changeset
268 %! colororder = get (gca, "ColorOrder");
4744a878c43f plotyy.m, copyobj.m: Change %!demo code to run under Matlab (bug #55841).
Rik <rik@octave.org>
parents: 26376
diff changeset
269 %! lcolor = colororder(1,:);
4744a878c43f plotyy.m, copyobj.m: Change %!demo code to run under Matlab (bug #55841).
Rik <rik@octave.org>
parents: 26376
diff changeset
270 %! rcolor = colororder(2,:);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21859
diff changeset
271 %! text (0.5, 0.5, "Left Axis", ...
22800
5de8670d10a6 Change text describing demo plots to reflect new ColorOrder (bug #49288).
Rik <rik@octave.org>
parents: 22323
diff changeset
272 %! "color", lcolor, "horizontalalignment", "center", "parent", ax(1));
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21859
diff changeset
273 %! text (4.5, 80, "Right Axis", ...
22800
5de8670d10a6 Change text describing demo plots to reflect new ColorOrder (bug #49288).
Rik <rik@octave.org>
parents: 22323
diff changeset
274 %! "color", rcolor, "horizontalalignment", "center", "parent", ax(2));
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
275 %! title ({"plotyy() example"; "left axis uses @plot, right axis uses @semilogy"});
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
276
9349
93664cbb732c plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents: 9346
diff changeset
277 %!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
278 %! clf;
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21859
diff changeset
279 %! colormap ("default");
9349
93664cbb732c plotyy.m: Fix compatibility with subplot.
Ben Abbott <bpabbott@mac.com>
parents: 9346
diff changeset
280 %! x = linspace (-1, 1, 201);
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
281 %! 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
282 %! plotyy (x,sin(pi*x), x,10*cos(pi*x));
24388
206ef5cb8b16 Add titles to most plot demos.
Rik <rik@octave.org>
parents: 24294
diff changeset
283 %! title ("plotyy() in subplot");
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
284 %! 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
285 %! surf (peaks (25));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
286 %! 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
287 %! contour (peaks (25));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
288 %! 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
289 %! plotyy (x,10*sin(2*pi*x), x,cos(2*pi*x));
24388
206ef5cb8b16 Add titles to most plot demos.
Rik <rik@octave.org>
parents: 24294
diff changeset
290 %! title ("plotyy() in subplot");
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21859
diff changeset
291 %! axis square;