annotate scripts/plot/appearance/grid.m @ 18927:fee51895ffe1

grid.m: Use '-' linestyle for major axis grid when minor grid is on. For Matlab compatibility, turn off major grid on log scale axes when minor grid is also on. * grid.m: Use '-' linestyle for major axis grid when minor grid is on. For Matlab compatibility, turn off major grid on log scale axes when minor grid is also on. Add new %!demo to show behavior.
author Rik <rik@octave.org>
date Thu, 03 Jul 2014 14:10:35 -0700
parents d63878346099
children 0e1f5a750d00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17572
diff changeset
1 ## Copyright (C) 1993-2013 John W. Eaton
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
2 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
3 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
4 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
8 ## your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
9 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
13 ## General Public License for more details.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
14 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
17 ## <http://www.gnu.org/licenses/>.
245
16a24e76d6e0 [project @ 1993-12-03 02:00:15 by jwe]
jwe
parents: 4
diff changeset
18
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 2847
diff changeset
19 ## -*- texinfo -*-
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
20 ## @deftypefn {Command} {} grid
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
21 ## @deftypefnx {Command} {} grid on
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
22 ## @deftypefnx {Command} {} grid off
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
23 ## @deftypefnx {Command} {} grid minor
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
24 ## @deftypefnx {Command} {} grid minor on
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
25 ## @deftypefnx {Command} {} grid minor off
8528
06e1667d7492 grid.m: Correct doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 8507
diff changeset
26 ## @deftypefnx {Function File} {} grid (@var{hax}, @dots{})
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
27 ## Control the display of plot grid lines.
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
28 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17122
diff changeset
29 ## The function state input may be either @qcode{"on"} or @qcode{"off"}.
8528
06e1667d7492 grid.m: Correct doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 8507
diff changeset
30 ## If it is omitted, the current grid state is toggled.
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
31 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17122
diff changeset
32 ## When the first argument is @qcode{"minor"} all subsequent commands
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
33 ## modify the minor grid rather than the major grid.
8528
06e1667d7492 grid.m: Correct doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 8507
diff changeset
34 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
35 ## If the first argument @var{hax} is an axes handle, then operate on
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
36 ## this axis rather than the current axes returned by @code{gca}.
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
37 ##
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
38 ## To control the grid lines for an individual axis use the @code{set}
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
39 ## function. For example:
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
40 ##
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
41 ## @example
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
42 ## set (gca, "ygrid", "on");
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
43 ## @end example
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17085
diff changeset
44 ## @seealso{axis, box}
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 2847
diff changeset
45 ## @end deftypefn
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
46
2314
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
47 ## Author: jwe
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
48
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
49 function grid (varargin)
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
50
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
51 [hax, varargin, nargs] = __plt_get_axis_arg__ ("grid", varargin{:});
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
52
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
53 if (isempty (hax))
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
54 hax = gca ();
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
55 endif
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
56
8424
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
57 if (nargs > 2)
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
58 print_usage ();
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
59 endif
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
60
18927
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
61 grid_on = any (strcmp (get (hax, {"xgrid", "ygrid", "zgrid"}), "on"));
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
62
18927
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
63 minor_on = any (strcmp (get (hax, {"xminorgrid", "yminorgrid", "zminorgrid"}),
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
64 "on"));
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
65
17520
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
66 minor_auto = true;
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
67 if (nargs == 0)
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
68 grid_on = ! grid_on;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
69 else
17520
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
70 arg1 = varargin{1};
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
71 if (! ischar (arg1))
17085
d3ebc3f9bdbf doc update for grid and subplot
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17049
diff changeset
72 error ("grid: argument 1 must be an axis handle or a string");
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
73 endif
17520
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
74 if (strcmpi (arg1, "off"))
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
75 grid_on = false;
17520
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
76 elseif (strcmpi (arg1, "on"))
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
77 grid_on = true;
17520
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
78 elseif (strcmpi (arg1, "minor"))
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
79 minor_auto = false;
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
80 if (nargs == 2)
17520
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
81 arg2 = varargin{2};
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
82 if (strcmpi (arg2, "on"))
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
83 minor_on = true;
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
84 grid_on = true;
17520
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
85 elseif (strcmpi (arg2, "off"))
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
86 minor_on = false;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9374
diff changeset
87 else
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
88 print_usage ();
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9374
diff changeset
89 endif
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
90 else
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
91 minor_on = ! minor_on;
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
92 if (minor_on)
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
93 grid_on = true;
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
94 endif
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
95 endif
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
96 else
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
97 print_usage ();
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
98 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
99 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
100
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
101 if (grid_on)
18927
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
102 set (hax, "xgrid", "on", "ygrid", "on", "zgrid", "on",
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
103 "gridlinestyle", ":");
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
104 if (minor_on)
18927
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
105 set (hax, "xminorgrid", "on", "yminorgrid", "on", "zminorgrid", "on",
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
106 "gridlinestyle", "-", "minorgridlinestyle", ":");
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
107 xg = ifelse (strcmp (get (hax, "xscale"), "log"), "off", "on");
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
108 yg = ifelse (strcmp (get (hax, "yscale"), "log"), "off", "on");
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
109 zg = ifelse (strcmp (get (hax, "zscale"), "log"), "off", "on");
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
110 set (hax, "xgrid", xg, "ygrid", yg, "zgrid", zg);
17520
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
111 elseif (minor_auto)
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
112 xmg = ifelse (strcmp (get (hax, "xscale"), "log"), "on", "off");
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
113 ymg = ifelse (strcmp (get (hax, "yscale"), "log"), "on", "off");
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
114 zmg = ifelse (strcmp (get (hax, "zscale"), "log"), "on", "off");
8a303b01cdd0 grid.m: 'grid on' now also turns on minor grid for log scale axes.
Rik <rik@octave.org>
parents: 17281
diff changeset
115 set (hax, "xminorgrid", xmg, "yminorgrid", ymg, "zminorgrid", zmg);
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
116 else
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
117 set (hax, "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
118 endif
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
119 else
17049
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
120 set (hax, "xgrid", "off", "ygrid", "off", "zgrid", "off",
0322e057697f hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14245
diff changeset
121 "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
5152
b111ca4715c6 [project @ 2005-02-21 19:41:23 by jwe]
jwe
parents: 5053
diff changeset
122 endif
b111ca4715c6 [project @ 2005-02-21 19:41:23 by jwe]
jwe
parents: 5053
diff changeset
123
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
124 endfunction
9374
6a035159ba0e grid.m: Add missing semi-colon. Fix grid toggle. Allow minor grid when no minor tick.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
125
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
126
9374
6a035159ba0e grid.m: Add missing semi-colon. Fix grid toggle. Allow minor grid when no minor tick.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
127 %!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
128 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
129 %! 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
130 %! plot (1:100);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
131 %! grid off;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
132 %! title ('no grid');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
133 %! 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
134 %! plot (1:100);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
135 %! grid on;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
136 %! title ('grid on');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
137 %! 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
138 %! plot (1:100);
18927
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
139 %! grid off;
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
140 %! title ('no grid');
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
141 %! subplot (2,2,4);
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
142 %! plot (1:100);
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
143 %! grid minor;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
144 %! title ('grid minor');
18927
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
145
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
146 %!demo
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
147 %! subplot (2,2,1);
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
148 %! semilogy (1:100);
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
149 %! grid off;
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
150 %! title ('no grid');
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
151 %! subplot (2,2,2);
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
152 %! semilogy (1:100);
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
153 %! grid on;
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
154 %! title ('grid on');
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
155 %! subplot (2,2,3);
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
156 %! semilogy (1:100);
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
157 %! grid off;
fee51895ffe1 grid.m: Use '-' linestyle for major axis grid when minor grid is on.
Rik <rik@octave.org>
parents: 17744
diff changeset
158 %! title ('no grid');
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
159 %! 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
160 %! semilogy (1:100);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
161 %! grid minor;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
162 %! title ('grid minor');
9374
6a035159ba0e grid.m: Add missing semi-colon. Fix grid toggle. Allow minor grid when no minor tick.
Ben Abbott <bpabbott@mac.com>
parents: 8920
diff changeset
163