Mercurial > hg > octave-lyh
annotate scripts/plot/scatter.m @ 10793:be55736a0783
Grammarcheck the documentation from m-files.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 18 Jul 2010 20:35:16 -0700 |
parents | 657e63dcfd88 |
children | a0dfd7e8e3e2 |
rev | line source |
---|---|
9245 | 1 ## Copyright (C) 2007, 2009 David Bateman |
7189 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10701
diff
changeset
|
20 ## @deftypefn {Function File} {} scatter (@var{x}, @var{y}) |
10699
da51afafca80
scatter.m: Add new calling forms of function to documentation.
Rik <octave@nomad.inbox5.com>
parents:
10697
diff
changeset
|
21 ## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}) |
da51afafca80
scatter.m: Add new calling forms of function to documentation.
Rik <octave@nomad.inbox5.com>
parents:
10697
diff
changeset
|
22 ## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{c}) |
da51afafca80
scatter.m: Add new calling forms of function to documentation.
Rik <octave@nomad.inbox5.com>
parents:
10697
diff
changeset
|
23 ## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c}) |
da51afafca80
scatter.m: Add new calling forms of function to documentation.
Rik <octave@nomad.inbox5.com>
parents:
10697
diff
changeset
|
24 ## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c}, 'filled') |
da51afafca80
scatter.m: Add new calling forms of function to documentation.
Rik <octave@nomad.inbox5.com>
parents:
10697
diff
changeset
|
25 ## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c}, @var{style}) |
da51afafca80
scatter.m: Add new calling forms of function to documentation.
Rik <octave@nomad.inbox5.com>
parents:
10697
diff
changeset
|
26 ## @deftypefnx {Function File} {} scatter (@var{x}, @var{y}, @var{s}, @var{c}, @var{prop}, @var{val}) |
7189 | 27 ## @deftypefnx {Function File} {} scatter (@var{h}, @dots{}) |
28 ## @deftypefnx {Function File} {@var{h} =} scatter (@dots{}) | |
29 ## | |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
7245
diff
changeset
|
30 ## Plot a scatter plot of the data. A marker is plotted at each point |
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
7245
diff
changeset
|
31 ## defined by the points in the vectors @var{x} and @var{y}. The size of |
7189 | 32 ## the markers used is determined by the @var{s}, which can be a scalar, |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
7245
diff
changeset
|
33 ## a vector of the same length of @var{x} and @var{y}. If @var{s} is not |
7189 | 34 ## given or is an empty matrix, then the default value of 8 points is used. |
35 ## | |
36 ## The color of the markers is determined by @var{c}, which can be a string | |
37 ## defining a fixed color, a 3 element vector giving the red, green and blue | |
38 ## components of the color, a vector of the same length as @var{x} that gives | |
39 ## a scaled index into the current colormap, or a @var{n}-by-3 matrix defining | |
40 ## the colors of each of the markers individually. | |
41 ## | |
42 ## The marker to use can be changed with the @var{style} argument, that is a | |
43 ## string defining a marker in the same manner as the @code{plot} command. | |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
7245
diff
changeset
|
44 ## If the argument 'filled' is given then the markers as filled. All |
7189 | 45 ## additional arguments are passed to the underlying patch command. |
46 ## | |
47 ## The optional return value @var{h} provides a handle to the patch object | |
48 ## | |
49 ## @example | |
50 ## @group | |
51 ## x = randn (100, 1); | |
52 ## y = randn (100, 1); | |
53 ## scatter (x, y, [], sqrt(x.^2 + y.^2)); | |
54 ## @end group | |
55 ## @end example | |
56 ## | |
57 ## @seealso{plot, patch, scatter3} | |
58 ## @end deftypefn | |
59 | |
60 function retval = scatter (varargin) | |
61 | |
7215 | 62 [h, varargin, nargin] = __plt_get_axis_arg__ ("scatter", varargin{:}); |
63 | |
7189 | 64 if (nargin < 2) |
65 print_usage (); | |
7215 | 66 else |
7189 | 67 oldh = gca (); |
68 unwind_protect | |
69 axes (h); | |
70 newplot (); | |
7215 | 71 tmp = __scatter__ (h, 2, "scatter", varargin{:}); |
7189 | 72 unwind_protect_cleanup |
73 axes (oldh); | |
74 end_unwind_protect | |
75 endif | |
76 | |
77 if (nargout > 0) | |
78 retval = tmp; | |
79 endif | |
80 | |
81 endfunction | |
7245 | 82 |
83 %!demo | |
84 %! x = randn (100, 1); | |
85 %! y = randn (100, 1); | |
10697
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
86 %! scatter (x, y, "r") |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
87 |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
88 %!demo |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
89 %! x = randn (100, 1); |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
90 %! y = randn (100, 1); |
7245 | 91 %! scatter (x, y, [], sqrt(x.^2 + y.^2)); |
10697
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
92 |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
93 %!demo |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
94 %! x = rand (10, 1); |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
95 %! y = rand (10, 1); |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
96 %! s = 10 - 10 * log (x.^2+y.^2); |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
97 %! h = scatter (x, y, s, s, "s", "filled"); |
1215ab6f3491
Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents:
9245
diff
changeset
|
98 |
10701
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
99 %!demo |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
100 %! x = rand (10, 1); |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
101 %! y = rand (10, 1); |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
102 %! s = 10 - 10 * log (x.^2+y.^2); |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
103 %! h = scatter (x, y, [], "r", "s", "filled"); |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
104 |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
105 %!demo |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
106 %! x = rand (10, 1); |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
107 %! y = rand (10, 1); |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
108 %! s = 10 - 10 * log (x.^2+y.^2); |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
109 %! h = scatter (x, y, [], "r", "s"); |
657e63dcfd88
scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents:
10699
diff
changeset
|
110 |