Mercurial > hg > octave-lyh
comparison scripts/plot/scatter.m @ 14245:4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
* contrast.m, axis.m, clabel.m, colorbar.m, comet.m, contour.m, contour3.m,
cylinder.m, daspect.m, errorbar.m, ezplot.m, fplot.m, grid.m, hold.m,
isosurface.m, legend.m, loglog.m, loglogerr.m, pareto.m, patch.m, pbaspect.m,
pie.m, pie3.m, plot3.m, plotmatrix.m, plotyy.m, quiver.m, quiver3.m,
rectangle.m, refreshdata.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m,
semilogy.m, semilogyerr.m, shading.m, stem.m, subplot.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: Use Matlab coding conventions
for demos so that compare plots scripts will function.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 22 Jan 2012 07:31:32 -0800 |
parents | 11949c9795a0 |
children | 566cf544d020 |
comparison
equal
deleted
inserted
replaced
14241:a52925666288 | 14245:4506eade9f04 |
---|---|
83 | 83 |
84 %!demo | 84 %!demo |
85 %! clf; | 85 %! clf; |
86 %! x = randn (100, 1); | 86 %! x = randn (100, 1); |
87 %! y = randn (100, 1); | 87 %! y = randn (100, 1); |
88 %! scatter (x, y, "r"); | 88 %! scatter (x, y, 'r'); |
89 %! title ("Scatter plot with red bubbles"); | 89 %! title ('Scatter plot with red bubbles'); |
90 | 90 |
91 %!demo | 91 %!demo |
92 %! clf; | 92 %! clf; |
93 %! x = randn (100, 1); | 93 %! x = randn (100, 1); |
94 %! y = randn (100, 1); | 94 %! y = randn (100, 1); |
95 %! scatter (x, y, [], sqrt (x.^2 + y.^2)); | 95 %! scatter (x, y, [], sqrt (x.^2 + y.^2)); |
96 %! title ("Scatter plot with bubble color determined by distance from origin"); | 96 %! title ('Scatter plot with bubble color determined by distance from origin'); |
97 | 97 |
98 %!demo | 98 %!demo |
99 %! clf; | 99 %! clf; |
100 %! rand_10x1_data1 = [0.171577, 0.404796, 0.025469, 0.335309, 0.047814, 0.898480, 0.639599, 0.700247, 0.497798, 0.737940]; | 100 %! rand_10x1_data1 = [0.171577, 0.404796, 0.025469, 0.335309, 0.047814, 0.898480, 0.639599, 0.700247, 0.497798, 0.737940]; |
101 %! rand_10x1_data2 = [0.75495, 0.83991, 0.80850, 0.73603, 0.19360, 0.72573, 0.69371, 0.74388, 0.13837, 0.54143]; | 101 %! rand_10x1_data2 = [0.75495, 0.83991, 0.80850, 0.73603, 0.19360, 0.72573, 0.69371, 0.74388, 0.13837, 0.54143]; |
102 %! x = rand_10x1_data1; | 102 %! x = rand_10x1_data1; |
103 %! y = rand_10x1_data2; | 103 %! y = rand_10x1_data2; |
104 %! s = 10 - 10*log (x.^2 + y.^2); | 104 %! s = 10 - 10*log (x.^2 + y.^2); |
105 %! h = scatter (x, y, s, s, "s", "filled"); | 105 %! h = scatter (x, y, s, s, 's', 'filled'); |
106 %! title ({"Scatter plot with filled square markers", ... | 106 %! title ({'Scatter plot with filled square markers', ... |
107 %! "size and color of markers determined by algorithm"}); | 107 %! 'size and color of markers determined by algorithm'}); |
108 | 108 |
109 %!demo | 109 %!demo |
110 %! clf; | 110 %! clf; |
111 %! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726]; | 111 %! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726]; |
112 %! rand_10x1_data4 = [0.020207, 0.527193, 0.443472, 0.061683, 0.370277, 0.947349, 0.249591, 0.666304, 0.134247, 0.920356]; | 112 %! rand_10x1_data4 = [0.020207, 0.527193, 0.443472, 0.061683, 0.370277, 0.947349, 0.249591, 0.666304, 0.134247, 0.920356]; |
113 %! x = rand_10x1_data3; | 113 %! x = rand_10x1_data3; |
114 %! y = rand_10x1_data4; | 114 %! y = rand_10x1_data4; |
115 %! s = 10 - 10*log (x.^2 + y.^2); | 115 %! s = 10 - 10*log (x.^2 + y.^2); |
116 %! h = scatter (x, y, [], "r", "s", "filled"); | 116 %! h = scatter (x, y, [], 'r', 's', 'filled'); |
117 | 117 |
118 %!demo | 118 %!demo |
119 %! clf; | 119 %! clf; |
120 %! rand_10x1_data5 = [0.777753, 0.093848, 0.183162, 0.399499, 0.337997, 0.686724, 0.073906, 0.651808, 0.869273, 0.137949]; | 120 %! rand_10x1_data5 = [0.777753, 0.093848, 0.183162, 0.399499, 0.337997, 0.686724, 0.073906, 0.651808, 0.869273, 0.137949]; |
121 %! rand_10x1_data6 = [0.37460, 0.25027, 0.19510, 0.51182, 0.54704, 0.56087, 0.24853, 0.75443, 0.42712, 0.44273]; | 121 %! rand_10x1_data6 = [0.37460, 0.25027, 0.19510, 0.51182, 0.54704, 0.56087, 0.24853, 0.75443, 0.42712, 0.44273]; |
122 %! x = rand_10x1_data5; | 122 %! x = rand_10x1_data5; |
123 %! y = rand_10x1_data6; | 123 %! y = rand_10x1_data6; |
124 %! s = 10 - 10*log (x.^2 + y.^2); | 124 %! s = 10 - 10*log (x.^2 + y.^2); |
125 %! h = scatter (x, y, [], "r", "s"); | 125 %! h = scatter (x, y, [], 'r', 's'); |
126 | 126 |
127 %!demo | 127 %!demo |
128 %! clf; | 128 %! clf; |
129 %! k = 1; | 129 %! k = 1; |
130 %! for m = [1, 3] | 130 %! for m = [1, 3] |
131 %! for n = [101, 50, 1] | 131 %! for n = [101, 50, 1] |
132 %! x = rand (n, 1); | 132 %! x = rand (n, 1); |
133 %! y = rand (n, 1); | 133 %! y = rand (n, 1); |
134 %! if (m > 1) | 134 %! if (m > 1) |
135 %! str = "Three Colors"; | 135 %! str = 'Three Colors'; |
136 %! idx = ceil (rand (n, 1) * 3); | 136 %! idx = ceil (rand (n, 1) * 3); |
137 %! colors = eye (3); | 137 %! colors = eye (3); |
138 %! colors = colors(idx, :); | 138 %! colors = colors(idx, :); |
139 %! else | 139 %! else |
140 %! str = "Random Colors"; | 140 %! str = 'Random Colors'; |
141 %! colors = rand (n, m); | 141 %! colors = rand (n, m); |
142 %! endif | 142 %! end |
143 %! if (n == 1) | 143 %! if (n == 1) |
144 %! str = sprintf ("%s: 1 point", str); | 144 %! str = sprintf ('%s: 1 point', str); |
145 %! elseif (n < 100) | 145 %! elseif (n < 100) |
146 %! str = sprintf ("%s: < 100 points", str); | 146 %! str = sprintf ('%s: < 100 points', str); |
147 %! else | 147 %! else |
148 %! str = sprintf ("%s: > 100 points", str); | 148 %! str = sprintf ('%s: > 100 points', str); |
149 %! endif | 149 %! end |
150 %! subplot (2,3,k); | 150 %! subplot (2,3,k); |
151 %! k = k + 1; | 151 %! k = k + 1; |
152 %! scatter (x, y, 15, colors, "filled"); | 152 %! scatter (x, y, 15, colors, 'filled'); |
153 %! axis ([0 1 0 1]); | 153 %! axis ([0 1 0 1]); |
154 %! title (str); | 154 %! title (str); |
155 %! endfor | 155 %! end |
156 %! endfor | 156 %! end |
157 | 157 |
158 %!demo | 158 %!demo |
159 %! clf; | 159 %! clf; |
160 %! k = 1; | 160 %! k = 1; |
161 %! for m = [1, 3] | 161 %! for m = [1, 3] |
162 %! for n = [101, 50, 1] | 162 %! for n = [101, 50, 1] |
163 %! x = rand (n, 1); | 163 %! x = rand (n, 1); |
164 %! y = rand (n, 1); | 164 %! y = rand (n, 1); |
165 %! if (m > 1) | 165 %! if (m > 1) |
166 %! str = "Three Colors"; | 166 %! str = 'Three Colors'; |
167 %! idx = ceil (rand (n, 1) * 3); | 167 %! idx = ceil (rand (n, 1) * 3); |
168 %! colors = eye (3); | 168 %! colors = eye (3); |
169 %! colors = colors(idx, :); | 169 %! colors = colors(idx, :); |
170 %! else | 170 %! else |
171 %! str = "Random Colors"; | 171 %! str = 'Random Colors'; |
172 %! colors = rand (n, m); | 172 %! colors = rand (n, m); |
173 %! endif | 173 %! end |
174 %! if (n == 1) | 174 %! if (n == 1) |
175 %! str = sprintf ("%s: 1 point", str); | 175 %! str = sprintf ('%s: 1 point', str); |
176 %! elseif (n < 100) | 176 %! elseif (n < 100) |
177 %! str = sprintf ("%s: < 100 points", str); | 177 %! str = sprintf ('%s: < 100 points', str); |
178 %! else | 178 %! else |
179 %! str = sprintf ("%s: > 100 points", str); | 179 %! str = sprintf ('%s: > 100 points', str); |
180 %! endif | 180 %! end |
181 %! subplot (2,3,k); | 181 %! subplot (2,3,k); |
182 %! k = k + 1; | 182 %! k = k + 1; |
183 %! scatter (x, y, 15, colors); | 183 %! scatter (x, y, 15, colors); |
184 %! axis ([0 1 0 1]); | 184 %! axis ([0 1 0 1]); |
185 %! title (str); | 185 %! title (str); |
186 %! endfor | 186 %! end |
187 %! endfor | 187 %! end |
188 | 188 |