annotate scripts/plot/grid.m @ 9051:1bf0ce0930be

Grammar check TexInfo in all .m files Cleanup documentation sources to follow a few consistent rules. Spellcheck was NOT done. (but will be in another changeset)
author Rik <rdrider0-list@yahoo.com>
date Fri, 27 Mar 2009 22:31:03 -0700
parents eb63fbe60fab
children 6a035159ba0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
1 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2003, 2004,
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8746
diff changeset
2 ## 2005, 2006, 2007, 2008, 2009 John W. Eaton
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
3 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
4 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
5 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
6 ## 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
7 ## 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
8 ## 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
9 ## your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
10 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
11 ## 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
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
13 ## 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
14 ## General Public License for more details.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
15 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
16 ## 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
17 ## 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
18 ## <http://www.gnu.org/licenses/>.
245
16a24e76d6e0 [project @ 1993-12-03 02:00:15 by jwe]
jwe
parents: 4
diff changeset
19
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 2847
diff changeset
20 ## -*- texinfo -*-
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 2847
diff changeset
21 ## @deftypefn {Function File} {} grid (@var{arg})
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
22 ## @deftypefnx {Function File} {} grid ("minor", @var{arg2})
8528
06e1667d7492 grid.m: Correct doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 8507
diff changeset
23 ## @deftypefnx {Function File} {} grid (@var{hax}, @dots{})
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
24 ## Force the display of a grid on the plot.
8528
06e1667d7492 grid.m: Correct doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 8507
diff changeset
25 ## The argument may be either @code{"on"}, or @code{"off"}.
06e1667d7492 grid.m: Correct doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 8507
diff changeset
26 ## 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
27 ##
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6828
diff changeset
28 ## If @var{arg} is @code{"minor"} then the minor grid is toggled. When
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
29 ## using a minor grid a second argument @var{arg2} is allowed, which can
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
30 ## be either @code{"on"} or @code{"off"} to explicitly set the state of
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
31 ## the minor grid.
8528
06e1667d7492 grid.m: Correct doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 8507
diff changeset
32 ##
06e1667d7492 grid.m: Correct doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 8507
diff changeset
33 ## If the first argument is an axis handle, @var{hax}, operate on the
06e1667d7492 grid.m: Correct doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 8507
diff changeset
34 ## specified axis object.
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6828
diff changeset
35 ## @seealso{plot}
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 2847
diff changeset
36 ## @end deftypefn
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
37
2314
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
38 ## Author: jwe
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
39
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
40 function grid (varargin)
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
41
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
42 persistent grid_on = false;
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
43 persistent minor_on = false;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
44
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
45 [ax, varargin, nargs] = __plt_get_axis_arg__ ("grid", varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
46
8424
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
47 if (nargs > 2)
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
48 print_usage ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
49 elseif (nargs == 0)
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
50 grid_on = ! grid_on;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
51 else
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
52 x = varargin{1};
5443
ec8c33dcd1bf [project @ 2005-09-08 01:40:57 by jwe]
jwe
parents: 5307
diff changeset
53 if (ischar (x))
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7216
diff changeset
54 if (strcmpi (x, "off"))
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
55 grid_on = false;
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7216
diff changeset
56 elseif (strcmpi (x, "on"))
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
57 grid_on = true;
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7216
diff changeset
58 elseif (strcmpi (x, "minor"))
8424
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
59 if (nargs == 2)
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
60 x2 = varargin{2};
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
61 if (strcmpi (x2, "on"))
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
62 minor_on = true;
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8501
diff changeset
63 grid_on = true;
8501
f729344c7362 grid.m: style fixes
John W. Eaton <jwe@octave.org>
parents: 8424
diff changeset
64 elseif (strcmpi (x2, "off"))
f729344c7362 grid.m: style fixes
John W. Eaton <jwe@octave.org>
parents: 8424
diff changeset
65 minor_on = false;
f729344c7362 grid.m: style fixes
John W. Eaton <jwe@octave.org>
parents: 8424
diff changeset
66 else
f729344c7362 grid.m: style fixes
John W. Eaton <jwe@octave.org>
parents: 8424
diff changeset
67 print_usage ();
8424
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
68 endif
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
69 else
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
70 minor_on = ! minor_on
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
71 if (minor_on)
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
72 grid_on = true;
a84d71abdc5b grid.m: handle minor grid option
Doug Stewart <dastew@sympatico.ca>
parents: 8190
diff changeset
73 endif
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
74 endif
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
75 else
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 5727
diff changeset
76 print_usage ();
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
77 endif
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
78 else
904
3470f1e25a79 [project @ 1994-11-09 21:22:15 by jwe]
jwe
parents: 245
diff changeset
79 error ("grid: argument must be a string");
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
80 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
81 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
82
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
83 if (grid_on)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
84 set (ax, "xgrid", "on", "ygrid", "on", "zgrid", "on");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
85 if (minor_on)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
86 set (ax, "xminorgrid", "on", "yminorgrid", "on", "zminorgrid", "on");
5727
f0fbefd984f6 [project @ 2006-04-03 18:50:31 by jwe]
jwe
parents: 5642
diff changeset
87 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
88 set (ax, "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
89 endif
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
90 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
91 set (ax, "xgrid", "off", "ygrid", "off", "zgrid", "off");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6046
diff changeset
92 set (ax, "xminorgrid", "off", "yminorgrid", "off", "zminorgrid", "off");
5152
b111ca4715c6 [project @ 2005-02-21 19:41:23 by jwe]
jwe
parents: 5053
diff changeset
93 endif
b111ca4715c6 [project @ 2005-02-21 19:41:23 by jwe]
jwe
parents: 5053
diff changeset
94
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
95 endfunction