annotate scripts/plot/scatter.m @ 14237:11949c9795a0

Revamp %!demos in m-files to use Octave coding conventions on spacing, etc. Add clf() to all demos using plot features to get reproducibility. Use 64 as input to all colormaps (jet (64)) to get reproducibility. * bicubic.m, cell2mat.m, celldisp.m, cplxpair.m, interp1.m, interp2.m, interpft.m, interpn.m, profile.m, profshow.m, convhull.m, delaunay.m, griddata.m, inpolygon.m, voronoi.m, autumn.m, bone.m, contrast.m, cool.m, copper.m, flag.m, gmap40.m, gray.m, hot.m, hsv.m, image.m, imshow.m, jet.m, ocean.m, pink.m, prism.m, rainbow.m, spring.m, summer.m, white.m, winter.m, condest.m, onenormest.m, axis.m, clabel.m, colorbar.m, comet.m, comet3.m, compass.m, contour.m, contour3.m, contourf.m, cylinder.m, daspect.m, ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m, fplot.m, grid.m, hold.m, isosurface.m, legend.m, loglog.m, loglogerr.m, pareto.m, patch.m, pbaspect.m, pcolor.m, pie.m, pie3.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m, rose.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m, shading.m, slice.m, sombrero.m, stairs.m, stem.m, stem3.m, subplot.m, surf.m, surfc.m, surfl.m, surfnorm.m, text.m, title.m, trimesh.m, triplot.m, trisurf.m, uigetdir.m, uigetfile.m, uimenu.m, uiputfile.m, waitbar.m, xlim.m, ylim.m, zlim.m, mkpp.m, pchip.m, polyaffine.m, spline.m, bicgstab.m, cgs.m, gplot.m, pcg.m, pcr.m, treeplot.m, strtok.m, demo.m, example.m, rundemos.m, speed.m, test.m, calendar.m, datestr.m, datetick.m, weekday.m: Revamp %!demos to use Octave coding conventions on spacing, etc.
author Rik <octave@nomad.inbox5.com>
date Fri, 20 Jan 2012 12:59:53 -0800
parents 72c96de7a403
children 4506eade9f04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 14011
diff changeset
1 ## Copyright (C) 2007-2012 David Bateman
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
2 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
3 ## This file is part of Octave.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
4 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
8 ## your option) any later version.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
9 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
13 ## General Public License for more details.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
14 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
18
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
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}, @var{style})
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{prop}, @var{val})
12124
cd82f5933c73 scatter: don't recognize 'filled' as a color
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
26 ## @deftypefnx {Function File} {} scatter (@dots{}, "filled")
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
27 ## @deftypefnx {Function File} {} scatter (@var{h}, @dots{})
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
28 ## @deftypefnx {Function File} {@var{h} =} scatter (@dots{})
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
29 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
30 ## Plot a scatter plot of the data. A marker is plotted at each point
9040
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
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
32 ## the markers used is determined by the @var{s}, which can be a scalar,
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
33 ## a vector of the same length of @var{x} and @var{y}. If @var{s} is not
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
34 ## given or is an empty matrix, then the default value of 8 points is used.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
35 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
36 ## The color of the markers is determined by @var{c}, which can be a string
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
37 ## defining a fixed color; a 3-element vector giving the red, green,and blue
11563
3c6e8aaa9555 Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
38 ## components of the color; a vector of the same length as @var{x} that gives
3c6e8aaa9555 Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
39 ## a scaled index into the current colormap; or a @var{n}-by-3 matrix defining
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
40 ## the colors of each of the markers individually.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
41 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
42 ## The marker to use can be changed with the @var{style} argument, that is a
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
43 ## string defining a marker in the same manner as the @code{plot} command.
12124
cd82f5933c73 scatter: don't recognize 'filled' as a color
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
44 ## If the argument @code{"filled"} is given then the markers as filled. All
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
45 ## additional arguments are passed to the underlying patch command.
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
46 ##
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
47 ## The optional return value @var{h} provides a handle to the patch object
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
48 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
49 ## @example
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
50 ## @group
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
51 ## x = randn (100, 1);
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
52 ## y = randn (100, 1);
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
53 ## scatter (x, y, [], sqrt(x.^2 + y.^2));
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
54 ## @end group
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
55 ## @end example
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
56 ##
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
57 ## @seealso{plot, patch, scatter3}
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
58 ## @end deftypefn
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
59
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
60 function retval = scatter (varargin)
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
61
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
62 [h, varargin, nargin] = __plt_get_axis_arg__ ("scatter", varargin{:});
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
63
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
64 if (nargin < 2)
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
65 print_usage ();
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
66 else
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
67 oldh = gca ();
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
68 unwind_protect
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
69 axes (h);
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
70 newplot ();
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
71 tmp = __scatter__ (h, 2, "scatter", varargin{:});
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
72 unwind_protect_cleanup
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
73 axes (oldh);
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
74 end_unwind_protect
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
75 endif
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
76
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
77 if (nargout > 0)
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
78 retval = tmp;
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
79 endif
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
80
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents:
diff changeset
81 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7215
diff changeset
82
11363
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
83
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7215
diff changeset
84 %!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
85 %! clf;
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7215
diff changeset
86 %! x = randn (100, 1);
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7215
diff changeset
87 %! y = randn (100, 1);
11363
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
88 %! scatter (x, y, "r");
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
89 %! title ("Scatter plot with red bubbles");
10697
1215ab6f3491 Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
90
1215ab6f3491 Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
91 %!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
92 %! clf;
10697
1215ab6f3491 Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
93 %! x = randn (100, 1);
1215ab6f3491 Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
94 %! y = randn (100, 1);
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13988
diff changeset
95 %! scatter (x, y, [], sqrt (x.^2 + y.^2));
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
96 %! title ("Scatter plot with bubble color determined by distance from origin");
10697
1215ab6f3491 Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
97
1215ab6f3491 Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
98 %!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
99 %! clf;
11363
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
100 %! rand_10x1_data1 = [0.171577, 0.404796, 0.025469, 0.335309, 0.047814, 0.898480, 0.639599, 0.700247, 0.497798, 0.737940];
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
101 %! rand_10x1_data2 = [0.75495, 0.83991, 0.80850, 0.73603, 0.19360, 0.72573, 0.69371, 0.74388, 0.13837, 0.54143];
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
102 %! x = rand_10x1_data1;
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
103 %! y = rand_10x1_data2;
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
104 %! s = 10 - 10*log (x.^2 + y.^2);
10697
1215ab6f3491 Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
105 %! h = scatter (x, y, s, s, "s", "filled");
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
106 %! title ({"Scatter plot with filled square markers", ...
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
107 %! "size and color of markers determined by algorithm"});
10697
1215ab6f3491 Honor Matlab color settings for scatter().
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
108
10701
657e63dcfd88 scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents: 10699
diff changeset
109 %!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
110 %! clf;
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
111 %! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726];
11363
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
112 %! rand_10x1_data4 = [0.020207, 0.527193, 0.443472, 0.061683, 0.370277, 0.947349, 0.249591, 0.666304, 0.134247, 0.920356];
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
113 %! x = rand_10x1_data3;
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
114 %! y = rand_10x1_data4;
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
115 %! s = 10 - 10*log (x.^2 + y.^2);
10701
657e63dcfd88 scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents: 10699
diff changeset
116 %! 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
117
657e63dcfd88 scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents: 10699
diff changeset
118 %!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
119 %! clf;
11363
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
120 %! rand_10x1_data5 = [0.777753, 0.093848, 0.183162, 0.399499, 0.337997, 0.686724, 0.073906, 0.651808, 0.869273, 0.137949];
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
121 %! rand_10x1_data6 = [0.37460, 0.25027, 0.19510, 0.51182, 0.54704, 0.56087, 0.24853, 0.75443, 0.42712, 0.44273];
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
122 %! x = rand_10x1_data5;
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
123 %! y = rand_10x1_data6;
a0dfd7e8e3e2 Assign data used in demo plots for reproducibility between runs
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
124 %! s = 10 - 10*log (x.^2 + y.^2);
10701
657e63dcfd88 scatter.m: Properly set default value markersize and marker type.
Ben Abbott <bpabbott@mac.com>
parents: 10699
diff changeset
125 %! 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
126
13988
7ab497513c1a Fix colour properties in scatter (bug #34936)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12124
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;
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
129 %! k = 1;
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
130 %! for m = [1, 3]
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
131 %! for n = [101, 50, 1]
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
132 %! x = rand (n, 1);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
133 %! y = rand (n, 1);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
134 %! if (m > 1)
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
135 %! str = "Three Colors";
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
136 %! idx = ceil (rand (n, 1) * 3);
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 %! colors = eye (3);
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
138 %! colors = colors(idx, :);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
139 %! else
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
140 %! str = "Random Colors";
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
141 %! colors = rand (n, m);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
142 %! endif
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
143 %! if (n == 1)
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
144 %! str = sprintf ("%s: 1 point", str);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
145 %! elseif (n < 100)
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
146 %! str = sprintf ("%s: < 100 points", str);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
147 %! else
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
148 %! str = sprintf ("%s: > 100 points", str);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
149 %! endif
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
150 %! subplot (2,3,k);
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
151 %! k = k + 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
152 %! scatter (x, y, 15, colors, "filled");
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
153 %! axis ([0 1 0 1]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
154 %! title (str);
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
155 %! endfor
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
156 %! endfor
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13988
diff changeset
157
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
158 %!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
159 %! clf;
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
160 %! k = 1;
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
161 %! for m = [1, 3]
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
162 %! for n = [101, 50, 1]
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
163 %! x = rand (n, 1);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
164 %! y = rand (n, 1);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
165 %! if (m > 1)
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
166 %! str = "Three Colors";
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
167 %! idx = ceil (rand (n, 1) * 3);
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
168 %! colors = eye (3);
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
169 %! colors = colors(idx, :);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
170 %! else
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
171 %! str = "Random Colors";
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
172 %! colors = rand (n, m);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
173 %! endif
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
174 %! if (n == 1)
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
175 %! str = sprintf ("%s: 1 point", str);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
176 %! elseif (n < 100)
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
177 %! str = sprintf ("%s: < 100 points", str);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
178 %! else
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
179 %! str = sprintf ("%s: > 100 points", str);
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
180 %! endif
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
181 %! subplot (2,3,k);
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
182 %! k = k + 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
183 %! scatter (x, y, 15, colors);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
184 %! axis ([0 1 0 1]);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
185 %! title (str);
14011
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
186 %! endfor
431c6b00653d scatter.m: Bug fix (34936).
Ben Abbott <bpabbott@mac.com>
parents: 14001
diff changeset
187 %! endfor
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
188