Mercurial > hg > octave-lyh
comparison scripts/plot/axis.m @ 5215:32c569794216
[project @ 2005-03-16 18:54:42 by jwe]
author | jwe |
---|---|
date | Wed, 16 Mar 2005 18:54:52 +0000 |
parents | eecc24b92d97 |
children | 3d9afb170a39 |
comparison
equal
deleted
inserted
replaced
5214:eecc24b92d97 | 5215:32c569794216 |
---|---|
127 ## However, with axis("manual") there is little need to know the current | 127 ## However, with axis("manual") there is little need to know the current |
128 ## limits. | 128 ## limits. |
129 | 129 |
130 if (nargin == 0) | 130 if (nargin == 0) |
131 if (nargout == 0) | 131 if (nargout == 0) |
132 __gset__ autoscale; | 132 __gnuplot_set__ autoscale; |
133 else | 133 else |
134 curr_axis = __current_axis__; | 134 curr_axis = __current_axis__; |
135 endif | 135 endif |
136 | 136 |
137 elseif (isstr (ax)) | 137 elseif (isstr (ax)) |
138 ax = tolower (ax); | 138 ax = tolower (ax); |
139 len = length (ax); | 139 len = length (ax); |
140 | 140 |
141 ## 'matrix mode' to reverse the y-axis | 141 ## 'matrix mode' to reverse the y-axis |
142 if (strcmp (ax, "ij")) | 142 if (strcmp (ax, "ij")) |
143 __gset__ yrange [] reverse; | 143 __gnuplot_set__ yrange [] reverse; |
144 elseif (strcmp (ax, "xy")) | 144 elseif (strcmp (ax, "xy")) |
145 __gset__ yrange [] noreverse; | 145 __gnuplot_set__ yrange [] noreverse; |
146 | 146 |
147 ## aspect ratio | 147 ## aspect ratio |
148 elseif (strcmp (ax, "image")) | 148 elseif (strcmp (ax, "image")) |
149 __gset__ size ratio -1; | 149 __gnuplot_set__ size ratio -1; |
150 __gset__ autoscale; ## XXX FIXME XXX should be the same as "tight" | 150 __gnuplot_set__ autoscale; ## XXX FIXME XXX should be the same as "tight" |
151 elseif (strcmp (ax, "equal")) | 151 elseif (strcmp (ax, "equal")) |
152 __gset__ size ratio -1; | 152 __gnuplot_set__ size ratio -1; |
153 elseif (strcmp (ax, "square")) | 153 elseif (strcmp (ax, "square")) |
154 __gset__ size ratio 1; | 154 __gnuplot_set__ size ratio 1; |
155 elseif (strcmp (ax, "normal")) | 155 elseif (strcmp (ax, "normal")) |
156 __gset__ size noratio; | 156 __gnuplot_set__ size noratio; |
157 | 157 |
158 | 158 |
159 ## axis limits | 159 ## axis limits |
160 elseif (len >= 4 && strcmp (ax(1:4), "auto")) | 160 elseif (len >= 4 && strcmp (ax(1:4), "auto")) |
161 if (len > 4) | 161 if (len > 4) |
162 eval (sprintf ("__gset__ autoscale %s;", ax(5:len))); | 162 eval (sprintf ("__gnuplot_set__ autoscale %s;", ax(5:len))); |
163 else | 163 else |
164 __gset__ autoscale; | 164 __gnuplot_set__ autoscale; |
165 endif | 165 endif |
166 elseif (strcmp (ax, "manual")) | 166 elseif (strcmp (ax, "manual")) |
167 ## fixes the axis limits, like axis(axis) should; | 167 ## fixes the axis limits, like axis(axis) should; |
168 __gset__ xrange [] writeback; | 168 __gnuplot_set__ xrange [] writeback; |
169 __gset__ yrange [] writeback; | 169 __gnuplot_set__ yrange [] writeback; |
170 __gset__ zrange [] writeback; | 170 __gnuplot_set__ zrange [] writeback; |
171 ## XXX FIXME XXX if writeback were set in plot, no need to replot here. | 171 ## XXX FIXME XXX if writeback were set in plot, no need to replot here. |
172 replot (); | 172 replot (); |
173 __gset__ noautoscale x; | 173 __gnuplot_set__ noautoscale x; |
174 __gset__ noautoscale y; | 174 __gnuplot_set__ noautoscale y; |
175 __gset__ noautoscale z; | 175 __gnuplot_set__ noautoscale z; |
176 elseif (strcmp (ax, "tight")) | 176 elseif (strcmp (ax, "tight")) |
177 ## XXX FIXME XXX if tight, plot must set ranges to limits of the | 177 ## XXX FIXME XXX if tight, plot must set ranges to limits of the |
178 ## all the data on the current plot, even if from a previous call. | 178 ## all the data on the current plot, even if from a previous call. |
179 ## Instead, just let gnuplot do as it likes. | 179 ## Instead, just let gnuplot do as it likes. |
180 __gset__ autoscale; | 180 __gnuplot_set__ autoscale; |
181 | 181 |
182 | 182 |
183 ## tic marks | 183 ## tic marks |
184 elseif (strcmp (ax, "on")) | 184 elseif (strcmp (ax, "on")) |
185 __gset__ xtics; | 185 __gnuplot_set__ xtics; |
186 __gset__ ytics; | 186 __gnuplot_set__ ytics; |
187 __gset__ ztics; | 187 __gnuplot_set__ ztics; |
188 __gset__ format; | 188 __gnuplot_set__ format; |
189 elseif (strcmp (ax, "off")) | 189 elseif (strcmp (ax, "off")) |
190 __gset__ noxtics; | 190 __gnuplot_set__ noxtics; |
191 __gset__ noytics; | 191 __gnuplot_set__ noytics; |
192 __gset__ noztics; | 192 __gnuplot_set__ noztics; |
193 elseif (strcmp (ax, "tic")) | 193 elseif (strcmp (ax, "tic")) |
194 __gset__ xtics; | 194 __gnuplot_set__ xtics; |
195 __gset__ ytics; | 195 __gnuplot_set__ ytics; |
196 __gset__ ztics; | 196 __gnuplot_set__ ztics; |
197 elseif (len > 3 && strcmp (ax(1:3), "tic")) | 197 elseif (len > 3 && strcmp (ax(1:3), "tic")) |
198 if (any (ax == "x")) | 198 if (any (ax == "x")) |
199 __gset__ xtics; | 199 __gnuplot_set__ xtics; |
200 else | 200 else |
201 __gset__ noxtics; | 201 __gnuplot_set__ noxtics; |
202 endif | 202 endif |
203 if (any (ax == "y")) | 203 if (any (ax == "y")) |
204 __gset__ ytics; | 204 __gnuplot_set__ ytics; |
205 else | 205 else |
206 __gset__ noytics; | 206 __gnuplot_set__ noytics; |
207 endif | 207 endif |
208 if (any (ax == "z")) | 208 if (any (ax == "z")) |
209 __gset__ ztics; | 209 __gnuplot_set__ ztics; |
210 else | 210 else |
211 __gset__ noztics; | 211 __gnuplot_set__ noztics; |
212 endif | 212 endif |
213 elseif (strcmp (ax, "label")) | 213 elseif (strcmp (ax, "label")) |
214 __gset__ format; | 214 __gnuplot_set__ format; |
215 elseif (strcmp (ax, "nolabel")) | 215 elseif (strcmp (ax, "nolabel")) |
216 __gset__ format "\\0"; | 216 __gnuplot_set__ format "\\0"; |
217 elseif (len > 5 && strcmp (ax(1:5), "label")) | 217 elseif (len > 5 && strcmp (ax(1:5), "label")) |
218 if (any (ax == "x")) | 218 if (any (ax == "x")) |
219 __gset__ format x; | 219 __gnuplot_set__ format x; |
220 else | 220 else |
221 __gset__ format x "\\0"; | 221 __gnuplot_set__ format x "\\0"; |
222 endif | 222 endif |
223 if (any (ax == "y")) | 223 if (any (ax == "y")) |
224 __gset__ format y; | 224 __gnuplot_set__ format y; |
225 else | 225 else |
226 __gset__ format y "\\0"; | 226 __gnuplot_set__ format y "\\0"; |
227 endif | 227 endif |
228 if (any (ax == "z")) | 228 if (any (ax == "z")) |
229 __gset__ format z; | 229 __gnuplot_set__ format z; |
230 else | 230 else |
231 __gset__ format z "\\0"; | 231 __gnuplot_set__ format z "\\0"; |
232 endif | 232 endif |
233 | 233 |
234 else | 234 else |
235 warning ("unknown axis option '%s'", ax); | 235 warning ("unknown axis option '%s'", ax); |
236 endif | 236 endif |
244 endif | 244 endif |
245 | 245 |
246 __current_axis__ = reshape (ax, 1, len); | 246 __current_axis__ = reshape (ax, 1, len); |
247 | 247 |
248 if (len > 1) | 248 if (len > 1) |
249 eval (sprintf ("__gset__ xrange [%g:%g];", ax(1), ax(2))); | 249 eval (sprintf ("__gnuplot_set__ xrange [%g:%g];", ax(1), ax(2))); |
250 endif | 250 endif |
251 | 251 |
252 if (len > 3) | 252 if (len > 3) |
253 eval (sprintf ("__gset__ yrange [%g:%g];", ax(3), ax(4))); | 253 eval (sprintf ("__gnuplot_set__ yrange [%g:%g];", ax(3), ax(4))); |
254 endif | 254 endif |
255 | 255 |
256 if (len > 5) | 256 if (len > 5) |
257 eval (sprintf ("__gset__ zrange [%g:%g];", ax(5), ax(6))); | 257 eval (sprintf ("__gnuplot_set__ zrange [%g:%g];", ax(5), ax(6))); |
258 endif | 258 endif |
259 | 259 |
260 else | 260 else |
261 error ("axis: expecting no args, or a vector with 2, 4, or 6 elements"); | 261 error ("axis: expecting no args, or a vector with 2, 4, or 6 elements"); |
262 endif | 262 endif |