Mercurial > hg > octave-lyh
annotate scripts/plot/__go_draw_axes__.m @ 8218:8a5fbd656f55
make previous change work for surface plots
author | Daniel J. Sebald <daniel.sebald@ieee.org> |
---|---|
date | Wed, 15 Oct 2008 10:51:59 -0400 |
parents | f74cb5e3a6c1 |
children | 4e05ba66ead2 |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 2005, 2007 John W. Eaton |
6405 | 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 | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6405 | 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 | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6405 | 18 |
6895 | 19 ## Undocumented internal function. |
6405 | 20 |
21 ## Author: jwe | |
22 | |
7269 | 23 function __go_draw_axes__ (h, plot_stream, enhanced, mono) |
6405 | 24 |
7269 | 25 if (nargin == 4) |
6405 | 26 |
7379 | 27 axis_obj = __get__ (h); |
6405 | 28 |
29 parent_figure_obj = get (axis_obj.parent); | |
30 | |
8208 | 31 pos = axis_obj.position; |
32 fprintf (plot_stream, "set tmargin 0;\n"); | |
33 fprintf (plot_stream, "set bmargin 0;\n"); | |
34 fprintf (plot_stream, "set lmargin 0;\n"); | |
35 fprintf (plot_stream, "set rmargin 0;\n"); | |
36 | |
37 ## Set to false for plotyy axes. | |
38 if (strcmp (axis_obj.tag, "plotyy")) | |
8102 | 39 ymirror = false; |
8208 | 40 else |
41 ymirror = true; | |
7189 | 42 endif |
43 | |
44 fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2)); | |
45 fprintf (plot_stream, "set size %.15g, %.15g;\n", pos(3), pos(4)); | |
46 | |
6758 | 47 if (strcmpi (axis_obj.dataaspectratiomode, "manual")) |
6405 | 48 r = axis_obj.dataaspectratio; |
6914 | 49 fprintf (plot_stream, "set size ratio %.15g;\n", -r(2)/r(1)); |
6405 | 50 else |
51 fputs (plot_stream, "set size noratio;\n"); | |
52 endif | |
53 | |
6778 | 54 fputs (plot_stream, "unset label;\n"); |
55 | |
6405 | 56 if (! isempty (axis_obj.title)) |
57 t = get (axis_obj.title); | |
58 if (isempty (t.string)) | |
59 fputs (plot_stream, "unset title;\n"); | |
60 else | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
61 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string"); |
7257 | 62 if (strcmp (f, "*")) |
63 fontspec = ""; | |
64 else | |
65 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
66 endif | |
7390 | 67 fprintf (plot_stream, "set title \"%s\" %s %s;\n", |
68 undo_string_escapes (tt), fontspec, | |
69 __do_enhanced_option__ (enhanced, t)); | |
6405 | 70 endif |
71 endif | |
72 | |
73 if (! isempty (axis_obj.xlabel)) | |
74 t = get (axis_obj.xlabel); | |
6737 | 75 angle = t.rotation; |
7269 | 76 colorspec = get_text_colorspec (axis_obj.xcolor, mono); |
6405 | 77 if (isempty (t.string)) |
7194 | 78 fprintf (plot_stream, "unset xlabel;\n"); |
79 fprintf (plot_stream, "unset x2label;\n"); | |
6405 | 80 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
81 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string"); |
7257 | 82 if (strcmp (f, "*")) |
83 fontspec = ""; | |
84 else | |
85 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
86 endif | |
7194 | 87 if (strcmpi (axis_obj.xaxislocation, "top")) |
7390 | 88 fprintf (plot_stream, "set x2label \"%s\" %s %s %s", |
89 undo_string_escapes (tt), colorspec, fontspec, | |
90 __do_enhanced_option__ (enhanced, t)); | |
7194 | 91 else |
7390 | 92 fprintf (plot_stream, "set xlabel \"%s\" %s %s %s", |
93 undo_string_escapes (tt), colorspec, fontspec, | |
94 __do_enhanced_option__ (enhanced, t)); | |
7194 | 95 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
96 fprintf (plot_stream, " rotate by %f;\n", angle); |
7194 | 97 if (strcmpi (axis_obj.xaxislocation, "top")) |
98 fprintf (plot_stream, "unset xlabel;\n"); | |
99 else | |
100 fprintf (plot_stream, "unset x2label;\n"); | |
101 endif | |
6405 | 102 endif |
103 endif | |
104 | |
105 if (! isempty (axis_obj.ylabel)) | |
106 t = get (axis_obj.ylabel); | |
6737 | 107 angle = t.rotation; |
7269 | 108 colorspec = get_text_colorspec (axis_obj.ycolor, mono); |
6405 | 109 if (isempty (t.string)) |
7194 | 110 fprintf (plot_stream, "unset ylabel;\n"); |
111 fprintf (plot_stream, "unset y2label;\n"); | |
6405 | 112 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
113 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string"); |
7257 | 114 if (strcmp (f, "*")) |
115 fontspec = ""; | |
116 else | |
117 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
118 endif | |
7194 | 119 if (strcmpi (axis_obj.yaxislocation, "right")) |
7390 | 120 fprintf (plot_stream, "set y2label \"%s\" %s %s %s", |
121 undo_string_escapes (tt), colorspec, fontspec, | |
122 __do_enhanced_option__ (enhanced, t)); | |
7194 | 123 else |
7390 | 124 fprintf (plot_stream, "set ylabel \"%s\" %s %s %s", |
125 undo_string_escapes (tt), colorspec, fontspec, | |
126 __do_enhanced_option__ (enhanced, t)); | |
7194 | 127 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
128 fprintf (plot_stream, " rotate by %f;\n", angle); |
7194 | 129 if (strcmpi (axis_obj.yaxislocation, "right")) |
130 fprintf (plot_stream, "unset ylabel;\n"); | |
131 else | |
132 fprintf (plot_stream, "unset y2label;\n"); | |
133 endif | |
6405 | 134 endif |
135 endif | |
136 | |
137 if (! isempty (axis_obj.zlabel)) | |
138 t = get (axis_obj.zlabel); | |
6737 | 139 angle = t.rotation; |
7269 | 140 colorspec = get_text_colorspec (axis_obj.zcolor, mono); |
6405 | 141 if (isempty (t.string)) |
142 fputs (plot_stream, "unset zlabel;\n"); | |
143 else | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
144 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string"); |
7257 | 145 if (strcmp (f, "*")) |
146 fontspec = ""; | |
147 else | |
148 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
149 endif | |
7390 | 150 fprintf (plot_stream, "set zlabel \"%s\" %s %s %s", |
151 undo_string_escapes (tt), colorspec, fontspec, | |
152 __do_enhanced_option__ (enhanced, t)); | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
153 fprintf (plot_stream, " rotate by %f;\n", angle); |
6405 | 154 endif |
155 endif | |
156 | |
6809 | 157 if (strcmpi (axis_obj.xaxislocation, "top")) |
158 xaxisloc = "x2"; | |
159 xaxisloc_using = "x2"; | |
160 else | |
161 xaxisloc = "x"; | |
162 xaxisloc_using = "x1"; | |
7321 | 163 if (strcmpi (axis_obj.xaxislocation, "zero")) |
164 fputs (plot_stream, "set xzeroaxis;\n"); | |
165 endif | |
6809 | 166 endif |
167 if (strcmpi (axis_obj.yaxislocation, "right")) | |
168 yaxisloc = "y2"; | |
169 yaxisloc_using = "y2"; | |
170 else | |
171 yaxisloc = "y"; | |
172 yaxisloc_using = "y1"; | |
7321 | 173 if (strcmpi (axis_obj.yaxislocation, "zero")) |
174 fputs (plot_stream, "set yzeroaxis;\n"); | |
175 endif | |
6809 | 176 endif |
177 | |
7274 | 178 have_grid = false; |
179 | |
6758 | 180 if (strcmpi (axis_obj.xgrid, "on")) |
7274 | 181 have_grid = true; |
6809 | 182 fprintf (plot_stream, "set grid %stics;\n", xaxisloc); |
6405 | 183 else |
6809 | 184 fprintf (plot_stream, "set grid no%stics;\n", xaxisloc); |
6405 | 185 endif |
186 | |
6758 | 187 if (strcmpi (axis_obj.ygrid, "on")) |
7274 | 188 have_grid = true; |
6809 | 189 fprintf (plot_stream, "set grid %stics;\n", yaxisloc); |
6405 | 190 else |
6809 | 191 fprintf (plot_stream, "set grid no%stics;\n", yaxisloc); |
6405 | 192 endif |
193 | |
6758 | 194 if (strcmpi (axis_obj.zgrid, "on")) |
7274 | 195 have_grid = true; |
6405 | 196 fputs (plot_stream, "set grid ztics;\n"); |
197 else | |
7085 | 198 fputs (plot_stream, "set grid noztics;\n"); |
6405 | 199 endif |
200 | |
6758 | 201 if (strcmpi (axis_obj.xminorgrid, "on")) |
7274 | 202 have_grid = true; |
6809 | 203 fprintf (plot_stream, "set m%stics 5;\n", xaxisloc); |
204 fprintf (plot_stream, "set grid m%stics;\n", xaxisloc); | |
6405 | 205 else |
6809 | 206 fprintf (plot_stream, "set grid nom%stics;\n", xaxisloc); |
6405 | 207 endif |
208 | |
6758 | 209 if (strcmpi (axis_obj.yminorgrid, "on")) |
7274 | 210 have_grid = true; |
6809 | 211 fprintf (plot_stream, "set m%stics 5;\n", yaxisloc); |
212 fprintf (plot_stream, "set grid m%stics;\n", yaxisloc); | |
6405 | 213 else |
6809 | 214 fprintf (plot_stream, "set grid nom%stics;\n", yaxisloc); |
6405 | 215 endif |
216 | |
6758 | 217 if (strcmpi (axis_obj.zminorgrid, "on")) |
7274 | 218 have_grid = true; |
6405 | 219 fputs (plot_stream, "set mztics 5;\n"); |
220 fputs (plot_stream, "set grid mztics;\n"); | |
221 else | |
222 fputs (plot_stream, "set grid nomztics;\n"); | |
223 endif | |
224 | |
7307 | 225 ## The grid front/back/layerdefault option also controls the |
226 ## appearance of tics, so it is used even if the grid is absent. | |
227 if (strcmpi (axis_obj.layer, "top")) | |
228 fputs (plot_stream, "set grid front;\n"); | |
229 else | |
230 fputs (plot_stream, "set grid layerdefault;\n"); | |
231 endif | |
7297 | 232 if (! have_grid) |
233 fputs (plot_stream, "unset grid;\n"); | |
7274 | 234 endif |
235 | |
7269 | 236 do_tics (axis_obj, plot_stream, ymirror, mono); |
6405 | 237 |
6758 | 238 xlogscale = strcmpi (axis_obj.xscale, "log"); |
6405 | 239 if (xlogscale) |
6809 | 240 fprintf (plot_stream, "set logscale %s;\n", xaxisloc); |
6405 | 241 else |
6809 | 242 fprintf (plot_stream, "unset logscale %s;\n", xaxisloc); |
6405 | 243 endif |
244 | |
6758 | 245 ylogscale = strcmpi (axis_obj.yscale, "log"); |
6405 | 246 if (ylogscale) |
6809 | 247 fprintf (plot_stream, "set logscale %s;\n", yaxisloc); |
6405 | 248 else |
6809 | 249 fprintf (plot_stream, "unset logscale %s;\n", yaxisloc); |
6405 | 250 endif |
251 | |
6758 | 252 zlogscale = strcmpi (axis_obj.zscale, "log"); |
6405 | 253 if (zlogscale) |
254 fputs (plot_stream, "set logscale z;\n"); | |
255 else | |
256 fputs (plot_stream, "unset logscale z;\n"); | |
257 endif | |
258 | |
6758 | 259 xautoscale = strcmpi (axis_obj.xlimmode, "auto"); |
260 yautoscale = strcmpi (axis_obj.ylimmode, "auto"); | |
261 zautoscale = strcmpi (axis_obj.zlimmode, "auto"); | |
7109 | 262 cautoscale = strcmpi (axis_obj.climmode, "auto"); |
7471
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
263 cdatadirect = false; |
7930
1f6eb3de1c4e
__img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents:
7873
diff
changeset
|
264 truecolor = false; |
6405 | 265 |
266 kids = axis_obj.children; | |
267 | |
7316 | 268 nd = __calc_dimensions__ (axis_obj); |
269 | |
270 if (nd == 3) | |
271 fputs (plot_stream, "set parametric;\n"); | |
272 fputs (plot_stream, "set style data lines;\n"); | |
273 fputs (plot_stream, "set surface;\n"); | |
274 fputs (plot_stream, "unset contour;\n"); | |
275 endif | |
276 | |
6405 | 277 data_idx = 0; |
278 data = cell (); | |
6464 | 279 is_image_data = []; |
7175 | 280 hidden_removal = NaN; |
7271 | 281 view_map = false; |
6405 | 282 |
7223 | 283 xlim = axis_obj.xlim; |
284 ylim = axis_obj.ylim; | |
285 zlim = axis_obj.zlim; | |
286 clim = axis_obj.clim; | |
6405 | 287 |
7222 | 288 if (! cautoscale && clim(1) == clim(2)) |
289 clim(2)++; | |
7189 | 290 endif |
291 | |
6405 | 292 [view_cmd, view_fcn, view_zoom] = image_viewer (); |
293 use_gnuplot_for_images = (ischar (view_fcn) | |
7583
1d7c23e288d7
__go_draw_axes__: use strcmpi for text properties; use get for hidden properties
John W. Eaton <jwe@octave.org>
parents:
7582
diff
changeset
|
294 && strcmpi (view_fcn, "gnuplot_internal")); |
6405 | 295 |
296 ximg_data = {}; | |
297 ximg_data_idx = 0; | |
298 | |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
299 while (! isempty (kids)) |
6405 | 300 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
301 obj = get (kids(1)); |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
302 kids = kids(2:end); |
6405 | 303 |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
304 if (strcmpi (obj.visible, "off")) |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
8048
diff
changeset
|
305 continue; |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
8048
diff
changeset
|
306 endif |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
8048
diff
changeset
|
307 |
8171
15ffb9836c01
__go_draw_axes__.m: Remove depdenence on gnuplot version.
Ben Abbott <bpabbott@mac.com>
parents:
8166
diff
changeset
|
308 ## Check for facecolor interpolation for surfaces. |
15ffb9836c01
__go_draw_axes__.m: Remove depdenence on gnuplot version.
Ben Abbott <bpabbott@mac.com>
parents:
8166
diff
changeset
|
309 doing_interp_color = ... |
15ffb9836c01
__go_draw_axes__.m: Remove depdenence on gnuplot version.
Ben Abbott <bpabbott@mac.com>
parents:
8166
diff
changeset
|
310 isfield (obj, "facecolor") && strncmp (obj.facecolor, "interp", 6); |
8166
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
311 |
6405 | 312 switch (obj.type) |
313 case "image" | |
314 img_data = obj.cdata; | |
315 img_xdata = obj.xdata; | |
316 img_ydata = obj.ydata; | |
317 | |
318 if (use_gnuplot_for_images) | |
319 | |
7930
1f6eb3de1c4e
__img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents:
7873
diff
changeset
|
320 if (ndims (img_data) == 3) |
1f6eb3de1c4e
__img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents:
7873
diff
changeset
|
321 truecolor = true; |
1f6eb3de1c4e
__img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents:
7873
diff
changeset
|
322 elseif (strcmpi (obj.cdatamapping, "direct")) |
7471
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
323 cdatadirect = true; |
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
324 endif |
7271 | 325 fputs (plot_stream, "set border front;\n"); |
6405 | 326 data_idx++; |
6464 | 327 is_image_data(data_idx) = true; |
6861 | 328 parametric(data_idx) = false; |
7119 | 329 have_cdata(data_idx) = false; |
6405 | 330 |
331 [y_dim, x_dim] = size (img_data(:,:,1)); | |
332 if (x_dim > 1) | |
333 dx = abs (img_xdata(2)-img_xdata(1))/(x_dim-1); | |
334 else | |
8208 | 335 x_dim = 2; |
336 img_data = [img_data, img_data]; | |
337 dx = abs (img_xdata(2)-img_xdata(1)); | |
6405 | 338 endif |
339 if (y_dim > 1) | |
340 dy = abs (img_ydata(2)-img_ydata(1))/(y_dim-1); | |
341 else | |
8208 | 342 y_dim = 2; |
343 img_data = [img_data; img_data]; | |
344 dy = abs (img_ydata(2)-img_ydata(1)); | |
6405 | 345 endif |
346 x_origin = min (img_xdata); | |
347 y_origin = min (img_ydata); | |
348 | |
349 if (ndims (img_data) == 3) | |
6464 | 350 data{data_idx} = permute (img_data, [3, 1, 2])(:); |
6405 | 351 format = "1:2:3"; |
352 imagetype = "rgbimage"; | |
353 else | |
6464 | 354 data{data_idx} = img_data(:); |
6405 | 355 format = "1"; |
356 imagetype = "image"; | |
357 endif | |
358 | |
6579 | 359 titlespec{data_idx} = "title \"\""; |
6914 | 360 usingclause{data_idx} = sprintf ("binary array=%dx%d scan=yx origin=(%.15g,%.15g) dx=%.15g dy=%.15g using %s", |
6405 | 361 x_dim, y_dim, x_origin, y_origin, dx, dy, format); |
362 withclause{data_idx} = sprintf ("with %s", imagetype); | |
363 | |
364 else | |
365 ximg_data{++ximg_data_idx} = img_data; | |
366 endif | |
367 | |
368 case "line" | |
7120 | 369 if (strncmp (obj.linestyle, "none", 4) |
370 && (! isfield (obj, "marker") | |
371 || (isfield (obj, "marker") | |
372 && strncmp (obj.marker, "none", 4)))) | |
373 continue; | |
374 endif | |
6405 | 375 data_idx++; |
6464 | 376 is_image_data(data_idx) = false; |
6861 | 377 parametric(data_idx) = true; |
7119 | 378 have_cdata(data_idx) = false; |
6405 | 379 if (isempty (obj.keylabel)) |
380 titlespec{data_idx} = "title \"\""; | |
381 else | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
382 tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "keylabel")); |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
383 titlespec{data_idx} = cstrcat ("title \"", tmp, "\""); |
6405 | 384 endif |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
385 usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata)); |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
386 errbars = ""; |
7316 | 387 if (nd == 3) |
6405 | 388 xdat = obj.xdata(:); |
389 ydat = obj.ydata(:); | |
7316 | 390 if (! isempty (obj.zdata)) |
391 zdat = obj.zdata(:); | |
392 else | |
393 zdat = zeros (size (xdat)); | |
394 endif | |
6405 | 395 data{data_idx} = [xdat, ydat, zdat]'; |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
396 usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", numel (xdat)); |
7316 | 397 ## fputs (plot_stream, "set parametric;\n"); |
6405 | 398 else |
399 xdat = obj.xdata(:); | |
400 ydat = obj.ydata(:); | |
401 ldat = obj.ldata; | |
402 yerr = xerr = false; | |
403 if (! isempty (ldat)) | |
404 yerr = true; | |
405 ldat = ldat(:); | |
406 endif | |
407 udat = obj.udata; | |
408 if (! isempty (udat)) | |
409 udat = udat(:); | |
410 endif | |
411 xldat = obj.xldata; | |
412 if (! isempty (xldat)) | |
413 xerr = true; | |
414 xldat = xldat(:); | |
415 endif | |
416 xudat = obj.xudata; | |
417 if (! isempty (xudat)) | |
418 xudat = xudat(:); | |
419 endif | |
420 if (yerr) | |
7213 | 421 if (isempty (ldat)) |
422 ylo = ydat; | |
423 else | |
424 ylo = ydat-ldat; | |
425 endif | |
426 if (isempty (udat)) | |
427 yhi = ydat; | |
428 else | |
429 yhi = ydat+udat; | |
430 endif | |
6405 | 431 if (xerr) |
7213 | 432 if (isempty (xldat)) |
433 xlo = xdat; | |
434 else | |
435 xlo = xdat-xldat; | |
436 endif | |
437 if (isempty (xudat)) | |
438 xhi = xdat; | |
439 else | |
440 xhi = xdat+xudat; | |
441 endif | |
6405 | 442 data{data_idx} = [xdat, ydat, xlo, xhi, ylo, yhi]'; |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
443 usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3):($4):($5):($6)", numel (xdat)); |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
444 errbars = "xyerrorbars"; |
6405 | 445 else |
446 data{data_idx} = [xdat, ydat, ylo, yhi]'; | |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
447 usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3):($4)", numel (xdat)); |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
448 errbars = "yerrorbars"; |
6405 | 449 endif |
450 elseif (xerr) | |
7236 | 451 if (isempty (xldat)) |
452 xlo = xdat; | |
453 else | |
454 xlo = xdat-xldat; | |
455 endif | |
456 if (isempty (xudat)) | |
457 xhi = xdat; | |
458 else | |
459 xhi = xdat+xudat; | |
460 endif | |
6405 | 461 data{data_idx} = [xdat, ydat, xlo, xhi]'; |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
462 usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3):($4)", numel (xdat)); |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
463 errbars = "xerrorbars"; |
6405 | 464 else |
465 data{data_idx} = [xdat, ydat]'; | |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
466 usingclause{data_idx} = sprintf ("record=%d using ($1):($2) axes %s%s", |
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
467 rows(xdat), xaxisloc_using, yaxisloc_using); |
6405 | 468 endif |
469 endif | |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
470 |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
471 [style, typ, with] = do_linestyle_command (obj, data_idx, mono, |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
472 plot_stream, errbars); |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
473 |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
474 withclause{data_idx} = sprintf ("with %s linestyle %d", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
475 style, data_idx); |
6405 | 476 |
6790 | 477 case "patch" |
6885 | 478 cmap = parent_figure_obj.colormap; |
7020 | 479 [nr, nc] = size (obj.xdata); |
480 | |
7189 | 481 if (! isempty (obj.cdata)) |
482 cdat = obj.cdata; | |
7583
1d7c23e288d7
__go_draw_axes__: use strcmpi for text properties; use get for hidden properties
John W. Eaton <jwe@octave.org>
parents:
7582
diff
changeset
|
483 if (strcmpi (obj.cdatamapping, "direct")) |
7471
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
484 cdatadirect = true; |
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
485 endif |
7189 | 486 else |
487 cdat = []; | |
488 endif | |
489 | |
7170 | 490 for i = 1:nc |
7020 | 491 xcol = obj.xdata(:,i); |
492 ycol = obj.ydata(:,i); | |
7316 | 493 if (nd == 3) |
494 if (! isempty (obj.zdata)) | |
495 zcol = obj.zdata(:,i); | |
496 else | |
497 zcol = zeros (size (xcol)); | |
498 endif | |
7170 | 499 endif |
7020 | 500 |
501 if (! isnan (xcol) && ! isnan (ycol)) | |
502 ## Is the patch closed or not | |
7175 | 503 if (strncmp (obj.facecolor, "none", 4)) |
7318 | 504 hidden_removal = false; |
505 else | |
7175 | 506 if (isnan (hidden_removal)) |
7318 | 507 hidden_removal = true; |
7175 | 508 endif |
7316 | 509 if (nd == 3) |
7170 | 510 error ("gnuplot (as of v4.2) only supports 2D filled patches"); |
511 endif | |
512 | |
513 data_idx++; | |
514 is_image_data(data_idx) = false; | |
515 parametric(data_idx) = false; | |
516 have_cdata(data_idx) = false; | |
517 if (i > 1 || isempty (obj.keylabel)) | |
518 titlespec{data_idx} = "title \"\""; | |
519 else | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
520 tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "keylabel")); |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
521 titlespec{data_idx} = cstrcat ("title \"", tmp, "\""); |
7170 | 522 endif |
7189 | 523 if (isfield (obj, "facecolor")) |
524 if ((strncmp (obj.facecolor, "flat", 4) | |
7284 | 525 || strncmp (obj.facecolor, "interp", 6)) |
526 && isfield (obj, "cdata")) | |
7170 | 527 if (ndims (obj.cdata) == 2 |
7189 | 528 && (size (obj.cdata, 2) == nc |
529 && (size (obj.cdata, 1) == 1 | |
530 || size (obj.cdata, 1) == 3))) | |
531 ccol = cdat (:, i); | |
532 elseif (ndims (obj.cdata) == 2 | |
533 && (size (obj.cdata, 1) == nc | |
534 && (size (obj.cdata, 2) == 1 | |
535 || size (obj.cdata, 2) == 3))) | |
536 ccol = cdat (i, :); | |
7170 | 537 elseif (ndims (obj.cdata) == 3) |
7189 | 538 ccol = permute (cdat (:, i, :), [1, 3, 2]); |
7170 | 539 else |
7189 | 540 ccol = cdat; |
7170 | 541 endif |
542 if (strncmp (obj.facecolor, "flat", 4)) | |
543 if (numel(ccol) == 3) | |
544 color = ccol; | |
545 else | |
7226 | 546 r = 1 + round ((size (cmap, 1) - 1) |
547 * (ccol - clim(1))/(clim(2) - clim(1))); | |
7170 | 548 r = max (1, min (r, size (cmap, 1))); |
549 color = cmap(r, :); | |
550 endif | |
551 elseif (strncmp (obj.facecolor, "interp", 6)) | |
7582 | 552 warning ("\"interp\" not supported, using 1st entry of cdata"); |
7170 | 553 r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); |
554 r = max (1, min (r, size (cmap, 1))); | |
555 color = cmap(r,:); | |
556 endif | |
7189 | 557 elseif (isnumeric (obj.facecolor)) |
558 color = obj.facecolor; | |
7170 | 559 else |
7189 | 560 color = [0, 1, 0]; |
7170 | 561 endif |
562 else | |
563 color = [0, 1, 0]; | |
564 endif | |
565 | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
566 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
567 colorspec = ""; |
7170 | 568 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
569 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
570 round (255*color)); |
7170 | 571 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
572 withclause{data_idx} = sprintf ("with filledcurve %s", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
573 colorspec); |
7170 | 574 data{data_idx} = [xcol, ycol]'; |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
575 usingclause{data_idx} = sprintf ("record=%d using ($1):($2)", numel (xcol)); |
7170 | 576 endif |
577 endif | |
578 | |
579 ## patch outline | |
580 if (! strncmp (obj.edgecolor, "none", 4)) | |
581 | |
582 data_idx++; | |
583 is_image_data(data_idx) = false; | |
584 parametric(data_idx) = false; | |
585 have_cdata(data_idx) = false; | |
586 titlespec{data_idx} = "title \"\""; | |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
587 usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata)); |
7189 | 588 |
589 if (isfield (obj, "markersize")) | |
7564
90536e155fde
adjust markersize by a factor of 1/6
John W. Eaton <jwe@octave.org>
parents:
7542
diff
changeset
|
590 mdat = obj.markersize / 6; |
7189 | 591 endif |
592 | |
593 if (isfield (obj, "edgecolor")) | |
594 if ((strncmp (obj.edgecolor, "flat", 4) | |
7284 | 595 || strncmp (obj.edgecolor, "interp", 6)) |
596 && isfield (obj, "cdata")) | |
7119 | 597 if (ndims (obj.cdata) == 2 |
7189 | 598 && (size (obj.cdata, 2) == nc |
599 && (size (obj.cdata, 1) == 1 | |
600 || size (obj.cdata, 1) == 3))) | |
601 ccol = cdat (:, i); | |
602 elseif (ndims (obj.cdata) == 2 | |
603 && (size (obj.cdata, 1) == nc | |
604 && (size (obj.cdata, 2) == 1 | |
605 || size (obj.cdata, 2) == 3))) | |
606 ccol = cdat (i, :); | |
7020 | 607 elseif (ndims (obj.cdata) == 3) |
7189 | 608 ccol = permute (cdat (:, i, :), [1, 3, 2]); |
7020 | 609 else |
7189 | 610 ccol = cdat; |
7020 | 611 endif |
7170 | 612 if (strncmp (obj.edgecolor, "flat", 4)) |
7189 | 613 if (numel(ccol) == 3) |
7020 | 614 color = ccol; |
615 else | |
7226 | 616 r = 1 + round ((size (cmap, 1) - 1) |
617 * (ccol - clim(1))/(clim(2) - clim(1))); | |
7020 | 618 r = max (1, min (r, size (cmap, 1))); |
619 color = cmap(r, :); | |
620 endif | |
7170 | 621 elseif (strncmp (obj.edgecolor, "interp", 6)) |
7582 | 622 warning ("\"interp\" not supported, using 1st entry of cdata"); |
7020 | 623 r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); |
624 r = max (1, min (r, size (cmap, 1))); | |
625 color = cmap(r,:); | |
626 endif | |
7189 | 627 elseif (isnumeric (obj.edgecolor)) |
628 color = obj.edgecolor; | |
629 else | |
630 color = [0, 0, 0]; | |
7020 | 631 endif |
632 else | |
7189 | 633 color = [0, 0, 0]; |
7020 | 634 endif |
7189 | 635 |
636 if (isfield (obj, "linestyle")) | |
637 switch (obj.linestyle) | |
638 case "-" | |
7317 | 639 lt = "lt 1"; |
7189 | 640 case "--" |
7317 | 641 lt = "lt 2"; |
7189 | 642 case ":" |
7317 | 643 lt = "lt 3"; |
7189 | 644 case "-." |
7317 | 645 lt = "lt 6"; |
7189 | 646 case "none" |
647 lt = ""; | |
648 otherwise | |
649 lt = ""; | |
650 endswitch | |
651 else | |
652 lt = ""; | |
653 endif | |
654 | |
7462
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
655 if (isfield (obj, "linewidth")) |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
656 lw = sprintf("linewidth %f", obj.linewidth); |
7462
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
657 else |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
658 lw = ""; |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
659 endif |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
660 |
7189 | 661 if (isfield (obj, "marker")) |
662 if (isfield (obj, "marker")) | |
663 switch (obj.marker) | |
664 case "+" | |
665 pt = "pt 1"; | |
666 case "o" | |
667 pt = "pt 6"; | |
668 case "*" | |
669 pt = "pt 3"; | |
670 case "." | |
671 pt = "pt 0"; | |
672 case "x" | |
673 pt = "pt 2"; | |
674 case {"square", "s"} | |
675 pt = "pt 5"; | |
676 case {"diamond", "d"} | |
677 pt = "pt 13"; | |
678 case "^" | |
679 pt = "pt 9"; | |
680 case "v" | |
681 pt = "pt 11"; | |
682 case ">" | |
683 pt = "pt 8"; | |
684 case "<" | |
685 pt = "pt 10"; | |
686 case {"pentagram", "p"} | |
687 pt = "pt 4"; | |
688 case {"hexagram", "h"} | |
689 pt = "pt 12"; | |
690 case "none" | |
691 pt = ""; | |
692 otherwise | |
693 pt = ""; | |
694 endswitch | |
695 endif | |
696 else | |
697 pt = ""; | |
698 endif | |
699 | |
700 style = "lines"; | |
701 if (isempty (lt)) | |
702 if (! isempty (pt)) | |
703 style = "points"; | |
704 endif | |
705 elseif (! isempty (pt)) | |
706 style = "linespoints"; | |
707 endif | |
708 | |
709 if (isfield (obj, "markersize")) | |
710 if (length (mdat) == nc) | |
7603
689652eb95d1
fix for scatter markersize
David Bateman <dbateman@free.fr>
parents:
7593
diff
changeset
|
711 m = mdat(i); |
7189 | 712 else |
7603
689652eb95d1
fix for scatter markersize
David Bateman <dbateman@free.fr>
parents:
7593
diff
changeset
|
713 m = mdat; |
7189 | 714 endif |
715 if (! strcmpi (style, "lines")) | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
716 ps = sprintf("pointsize %f", m); |
7189 | 717 else |
718 ps = ""; | |
719 endif | |
720 else | |
721 ps = ""; | |
722 endif | |
723 | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
724 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
725 colorspec = ""; |
7020 | 726 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
727 colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
728 round (255*color)); |
7020 | 729 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
730 withclause{data_idx} = sprintf ("with %s %s %s %s %s %s", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
731 style, lw, pt, lt, ps, |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
732 colorspec); |
6790 | 733 |
7316 | 734 if (nd == 3) |
7170 | 735 if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol)) |
736 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ... | |
737 [zcol; zcol(1)]]'; | |
738 else | |
739 data{data_idx} = [xcol, ycol, zcol]'; | |
740 endif | |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
741 usingclause{data_idx} = sprintf ("record=%d using ($1):($2):($3)", columns (data{data_idx})); |
7020 | 742 else |
7170 | 743 if (! isnan (xcol) && ! isnan (ycol)) |
744 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]'; | |
745 else | |
746 data{data_idx} = [xcol, ycol]'; | |
747 endif | |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
748 usingclause{data_idx} = sprintf ("record=%d using ($1):($2)", columns (data{data_idx})); |
7020 | 749 endif |
6885 | 750 endif |
7020 | 751 endfor |
6790 | 752 |
6405 | 753 case "surface" |
7271 | 754 view_map = true; |
7110 | 755 if (! (strncmp (obj.edgecolor, "none", 4) |
756 && strncmp (obj.facecolor, "none", 4))) | |
7109 | 757 data_idx++; |
758 is_image_data(data_idx) = false; | |
759 parametric(data_idx) = false; | |
7119 | 760 have_cdata(data_idx) = true; |
7170 | 761 [style, typ, with] = do_linestyle_command (obj, data_idx, |
7269 | 762 mono, plot_stream); |
7109 | 763 if (isempty (obj.keylabel)) |
764 titlespec{data_idx} = "title \"\""; | |
765 else | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
766 tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "keylabel")); |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
767 titlespec{data_idx} = cstrcat ("title \"", tmp, "\""); |
7109 | 768 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
769 withclause{data_idx} = sprintf ("with pm3d linestyle %d", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
770 data_idx); |
7109 | 771 |
772 xdat = obj.xdata; | |
773 ydat = obj.ydata; | |
774 zdat = obj.zdata; | |
775 cdat = obj.cdata; | |
7110 | 776 |
7109 | 777 err = false; |
778 if (! size_equal(zdat, cdat)) | |
6405 | 779 err = true; |
7109 | 780 endif |
781 if (isvector (xdat) && isvector (ydat) && ismatrix (zdat)) | |
7110 | 782 if (rows (zdat) == length (ydat) |
783 && columns (zdat) == length (xdat)) | |
7109 | 784 [xdat, ydat] = meshgrid (xdat, ydat); |
785 else | |
786 err = true; | |
787 endif | |
788 elseif (ismatrix (xdat) && ismatrix (ydat) && ismatrix (zdat)) | |
7292 | 789 if (! size_equal (xdat, ydat, zdat)) |
7109 | 790 err = true; |
791 endif | |
792 else | |
793 err = true; | |
794 endif | |
795 if (err) | |
796 error ("__go_draw_axes__: invalid grid data"); | |
6405 | 797 endif |
7109 | 798 xlen = columns (zdat); |
799 ylen = rows (zdat); | |
800 if (xlen == columns (xdat) && xlen == columns (ydat) | |
801 && ylen == rows (xdat) && ylen == rows (ydat)) | |
802 len = 4 * xlen; | |
803 zz = zeros (ylen, len); | |
804 k = 1; | |
805 for kk = 1:4:len | |
806 zz(:,kk) = xdat(:,k); | |
807 zz(:,kk+1) = ydat(:,k); | |
808 zz(:,kk+2) = zdat(:,k); | |
809 zz(:,kk+3) = cdat(:,k); | |
810 k++; | |
811 endfor | |
7170 | 812 data{data_idx} = zz.'; |
7109 | 813 endif |
814 | |
8166
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
815 if (doing_interp_color) |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
816 interp_str = "interpolate 4, 4"; |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
817 else |
8171
15ffb9836c01
__go_draw_axes__.m: Remove depdenence on gnuplot version.
Ben Abbott <bpabbott@mac.com>
parents:
8166
diff
changeset
|
818 ## No interpolation of facecolors. |
8166
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
819 interp_str = ""; |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
820 endif |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
821 usingclause{data_idx} = sprintf ("record=%dx%d using ($1):($2):($3):($4)", xlen, ylen); |
8166
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
822 |
7119 | 823 flat_interp_face = (strncmp (obj.facecolor, "flat", 4) |
824 || strncmp (obj.facecolor, "interp", 6)); | |
825 flat_interp_edge = (strncmp (obj.edgecolor, "flat", 4) | |
826 || strncmp (obj.edgecolor, "interp", 6)); | |
7154 | 827 |
828 facecolor_none_or_white = (strncmp (obj.facecolor, "none", 4) | |
829 || (isnumeric (obj.facecolor) | |
830 && all (obj.facecolor == 1))); | |
7582 | 831 hidden_removal = false; |
7592 | 832 fputs (plot_stream, "set style increment default;\n"); |
7318 | 833 if (flat_interp_edge && facecolor_none_or_white) |
7189 | 834 withclause{data_idx} = "with line palette"; |
7541
6acd0a18a3ee
If FaceColor is none don't use pm3d mode and set linestyle correctly.
kai@linux-pc
parents:
7540
diff
changeset
|
835 fputs (plot_stream, "unset pm3d\n"); |
7582 | 836 if (all (obj.facecolor == 1)) |
7592 | 837 hidden_removal = true; |
7582 | 838 endif |
7541
6acd0a18a3ee
If FaceColor is none don't use pm3d mode and set linestyle correctly.
kai@linux-pc
parents:
7540
diff
changeset
|
839 elseif (facecolor_none_or_white) |
6acd0a18a3ee
If FaceColor is none don't use pm3d mode and set linestyle correctly.
kai@linux-pc
parents:
7540
diff
changeset
|
840 edgecol = obj.edgecolor; |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
841 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
842 colorspec = ""; |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
843 else |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
844 colorspec = sprintf ("linecolor rgb \"#%02x%02x%02x\"", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
845 round (255*edgecol)); |
7541
6acd0a18a3ee
If FaceColor is none don't use pm3d mode and set linestyle correctly.
kai@linux-pc
parents:
7540
diff
changeset
|
846 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
847 if (all (obj.facecolor == 1)) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
848 hidden_removal = true; |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
849 endif |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
850 fputs(plot_stream,"unset pm3d;\n"); |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
851 fprintf (plot_stream, |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
852 "set style line %d %s lw %f;\n", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
853 data_idx, colorspec, obj.linewidth); |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
854 fputs(plot_stream,"set style increment user;\n"); |
7541
6acd0a18a3ee
If FaceColor is none don't use pm3d mode and set linestyle correctly.
kai@linux-pc
parents:
7540
diff
changeset
|
855 withclause{data_idx} = sprintf("with line linestyle %d", data_idx); |
7582 | 856 fputs (plot_stream, "unset pm3d\n"); |
7119 | 857 endif |
7109 | 858 |
8166
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
859 if (doing_interp_color) |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
860 ## "depthorder" interferes with interpolation of colors. |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
861 dord = "scansautomatic"; |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
862 else |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
863 dord = "depthorder"; |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
864 endif |
7109 | 865 |
7318 | 866 if (flat_interp_face && strncmp (obj.edgecolor, "flat", 4)) |
867 fprintf (plot_stream, "set pm3d explicit at s %s %s corners2color c3;\n", | |
7189 | 868 interp_str, dord); |
7318 | 869 elseif (!facecolor_none_or_white) |
7119 | 870 if (strncmp (obj.edgecolor, "none", 4)) |
7318 | 871 fprintf (plot_stream, "set pm3d explicit at s %s corners2color c3;\n", |
7189 | 872 interp_str, dord); |
7109 | 873 else |
7119 | 874 edgecol = obj.edgecolor; |
875 if (ischar (obj.edgecolor)) | |
7542
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
876 edgecol = [0, 0, 0]; |
7119 | 877 endif |
7318 | 878 fprintf (plot_stream, "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n", |
7189 | 879 data_idx, interp_str, dord); |
7119 | 880 |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
881 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
882 colorspec = ""; |
7119 | 883 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
884 colorspec = sprintf ("linecolor rgb \"#%02x%02x%02x\"", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
885 round (255*edgecol)); |
7119 | 886 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
887 fprintf (plot_stream, |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
888 "set style line %d %s lw %f;\n", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
889 data_idx, colorspec, obj.linewidth); |
7109 | 890 endif |
7119 | 891 endif |
6405 | 892 endif |
893 | |
894 case "text" | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
895 [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string"); |
7257 | 896 if (strcmp (f, "*")) |
897 fontspec = ""; | |
898 else | |
899 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
900 endif | |
6405 | 901 lpos = obj.position; |
902 halign = obj.horizontalalignment; | |
6724 | 903 angle = obj.rotation; |
6752 | 904 units = obj.units; |
6829 | 905 color = obj.color; |
6758 | 906 if (strcmpi (units, "normalized")) |
6752 | 907 units = "graph"; |
908 else | |
909 units = ""; | |
910 endif | |
911 | |
6829 | 912 if (isnumeric (color)) |
7269 | 913 colorspec = get_text_colorspec (color, mono); |
6829 | 914 endif |
915 | |
6405 | 916 if (nd == 3) |
6724 | 917 fprintf (plot_stream, |
7390 | 918 "set label \"%s\" at %s %.15g,%.15g,%.15g %s rotate by %f %s %s front %s;\n", |
7162 | 919 undo_string_escapes (label), units, lpos(1), |
7390 | 920 lpos(2), lpos(3), halign, angle, fontspec, |
921 __do_enhanced_option__ (enhanced, obj), colorspec); | |
6405 | 922 else |
7162 | 923 fprintf (plot_stream, |
7390 | 924 "set label \"%s\" at %s %.15g,%.15g %s rotate by %f %s %s front %s;\n", |
7162 | 925 undo_string_escapes (label), units, |
7390 | 926 lpos(1), lpos(2), halign, angle, fontspec, |
927 __do_enhanced_option__ (enhanced, obj), colorspec); | |
6405 | 928 endif |
929 | |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
930 case "hggroup" |
8216
5d6b9311be38
__go_draw_axes__.m: Fix concatenation of handles.
Ben Abbott <bpabbott@mac.com>
parents:
8208
diff
changeset
|
931 # push group children into the kid list |
5d6b9311be38
__go_draw_axes__.m: Fix concatenation of handles.
Ben Abbott <bpabbott@mac.com>
parents:
8208
diff
changeset
|
932 if (isempty (kids)) |
5d6b9311be38
__go_draw_axes__.m: Fix concatenation of handles.
Ben Abbott <bpabbott@mac.com>
parents:
8208
diff
changeset
|
933 kids = obj.children; |
5d6b9311be38
__go_draw_axes__.m: Fix concatenation of handles.
Ben Abbott <bpabbott@mac.com>
parents:
8208
diff
changeset
|
934 elseif (! isempty (obj.children)) |
5d6b9311be38
__go_draw_axes__.m: Fix concatenation of handles.
Ben Abbott <bpabbott@mac.com>
parents:
8208
diff
changeset
|
935 kids = [obj.children; kids]; |
5d6b9311be38
__go_draw_axes__.m: Fix concatenation of handles.
Ben Abbott <bpabbott@mac.com>
parents:
8208
diff
changeset
|
936 endif |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
937 |
6405 | 938 otherwise |
939 error ("__go_draw_axes__: unknown object class, %s", | |
940 obj.type); | |
941 endswitch | |
942 | |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
943 endwhile |
6405 | 944 |
7692
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
945 ## This is need to prevent warnings for rotations in 3D plots, while |
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
946 ## allowing colorbars with contours.. |
8042
827d4f24ec6c
Fix for meshed surfaces with more than one oobject per plot
David Bateman <dbateman@free.fr>
parents:
7930
diff
changeset
|
947 if (nd == 2 || (data_idx > 1 && !view_map)) |
7692
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
948 fputs (plot_stream, "set pm3d implicit;\n"); |
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
949 else |
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
950 fputs (plot_stream, "set pm3d explicit;\n"); |
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
951 endif |
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
952 |
7175 | 953 if (isnan(hidden_removal) || hidden_removal) |
7149 | 954 fputs (plot_stream, "set hidden3d;\n"); |
955 else | |
956 fputs (plot_stream, "unset hidden3d;\n"); | |
957 endif | |
958 | |
8048
2f7ff06c0c7b
__go_draw_axes__.m (__gnuplot_write_data__): write "Inf Inf\n" if all data pairs contain NaN values
John W. Eaton <jwe@octave.org>
parents:
8042
diff
changeset
|
959 have_data = (! (isempty (data) || all (cellfun (@isempty, data)))); |
6405 | 960 |
8208 | 961 ## Note we don't use the [xy]2range of gnuplot as we don't use the |
962 ## dual axis plotting features of gnuplot | |
7222 | 963 if (isempty (xlim)) |
964 return; | |
6405 | 965 endif |
6758 | 966 if (strcmpi (axis_obj.xdir, "reverse")) |
6405 | 967 xdir = "reverse"; |
968 else | |
969 xdir = "noreverse"; | |
970 endif | |
8208 | 971 fprintf (plot_stream, "set xrange [%.15e:%.15e] %s;\n", xlim, xdir); |
6405 | 972 |
7222 | 973 if (isempty (ylim)) |
974 return; | |
6405 | 975 endif |
6758 | 976 if (strcmpi (axis_obj.ydir, "reverse")) |
6405 | 977 ydir = "reverse"; |
978 else | |
979 ydir = "noreverse"; | |
980 endif | |
8208 | 981 fprintf (plot_stream, "set yrange [%.15e:%.15e] %s;\n", ylim, ydir); |
6405 | 982 |
7119 | 983 if (nd == 3) |
7222 | 984 if (isempty (zlim)) |
985 return; | |
6405 | 986 endif |
6758 | 987 if (strcmpi (axis_obj.zdir, "reverse")) |
6405 | 988 zdir = "reverse"; |
989 else | |
990 zdir = "noreverse"; | |
991 endif | |
8171
15ffb9836c01
__go_draw_axes__.m: Remove depdenence on gnuplot version.
Ben Abbott <bpabbott@mac.com>
parents:
8166
diff
changeset
|
992 fprintf (plot_stream, "set zrange [%.15e:%.15e] %s;\n", zlim, zdir); |
6405 | 993 endif |
7110 | 994 |
7471
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
995 cmap = parent_figure_obj.colormap; |
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
996 cmap_sz = rows(cmap); |
7930
1f6eb3de1c4e
__img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents:
7873
diff
changeset
|
997 |
7189 | 998 if (! any (isinf (clim))) |
7930
1f6eb3de1c4e
__img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents:
7873
diff
changeset
|
999 if (truecolor || ! cdatadirect) |
1f6eb3de1c4e
__img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents:
7873
diff
changeset
|
1000 fprintf (plot_stream, "set cbrange [%g:%g];\n", clim); |
1f6eb3de1c4e
__img__.m, imshow.m, __go_draw_axes__.m: improve handling of truecolor images
John W. Eaton <jwe@octave.org>
parents:
7873
diff
changeset
|
1001 else |
7471
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
1002 fprintf (plot_stream, "set cbrange [1:%d];\n", cmap_sz); |
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
1003 endif |
7189 | 1004 endif |
1005 | |
6758 | 1006 if (strcmpi (axis_obj.box, "on")) |
7119 | 1007 if (nd == 3) |
6405 | 1008 fputs (plot_stream, "set border 4095;\n"); |
1009 else | |
1010 fputs (plot_stream, "set border 431;\n"); | |
1011 endif | |
1012 else | |
7119 | 1013 if (nd == 3) |
6405 | 1014 fputs (plot_stream, "set border 895;\n"); |
1015 else | |
7320 | 1016 if (strcmpi (axis_obj.yaxislocation, "right")) |
7873
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1017 fprintf (plot_stream, "unset ytics; set y2tics %s nomirror\n", |
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1018 axis_obj.tickdir); |
7320 | 1019 if (strcmpi (axis_obj.xaxislocation, "top")) |
7873
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1020 fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n", |
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1021 axis_obj.tickdir); |
7320 | 1022 fputs (plot_stream, "set border 12;\n"); |
1023 else | |
7873
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1024 fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n", |
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1025 axis_obj.tickdir); |
7320 | 1026 fputs (plot_stream, "set border 9;\n"); |
1027 endif | |
1028 else | |
7873
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1029 fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n", |
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1030 axis_obj.tickdir); |
7320 | 1031 if (strcmpi (axis_obj.xaxislocation, "top")) |
7873
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1032 fprintf (plot_stream, "unset xtics; set x2tics %s nomirror\n", |
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1033 axis_obj.tickdir); |
7320 | 1034 fputs (plot_stream, "set border 6;\n"); |
1035 else | |
7873
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1036 fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n", |
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1037 axis_obj.tickdir); |
7320 | 1038 fputs (plot_stream, "set border 3;\n"); |
1039 endif | |
1040 endif | |
6405 | 1041 endif |
1042 endif | |
1043 | |
7060 | 1044 if (strcmpi (axis_obj.visible, "off")) |
1045 fputs (plot_stream, "unset border; unset tics\n"); | |
7565
1e6443ff960f
handle axes linewidth property
John W. Eaton <jwe@octave.org>
parents:
7564
diff
changeset
|
1046 else |
1e6443ff960f
handle axes linewidth property
John W. Eaton <jwe@octave.org>
parents:
7564
diff
changeset
|
1047 fprintf (plot_stream, "set border lw %f;\n", axis_obj.linewidth); |
7060 | 1048 endif |
1049 | |
6758 | 1050 if (strcmpi (axis_obj.key, "on")) |
1051 if (strcmpi (axis_obj.keybox, "on")) | |
6405 | 1052 box = "box"; |
1053 else | |
1054 box = "nobox"; | |
1055 endif | |
1056 inout = "inside"; | |
6977 | 1057 keypos = axis_obj.keypos; |
1058 if (ischar (keypos)) | |
1059 keypos = lower (keypos); | |
1060 keyout = findstr (keypos, "outside"); | |
1061 if (! isempty (keyout)) | |
1062 inout = "outside"; | |
7119 | 1063 keypos = keypos(1:keyout-1); |
6977 | 1064 endif |
1065 endif | |
1066 switch (keypos) | |
6405 | 1067 case -1 |
6977 | 1068 pos = "right top"; |
6405 | 1069 inout = "outside"; |
1070 case 1 | |
1071 pos = "right top"; | |
1072 case 2 | |
1073 pos = "left top"; | |
1074 case 3 | |
1075 pos = "left bottom"; | |
6977 | 1076 case {4, 0} |
6405 | 1077 pos = "right bottom"; |
6977 | 1078 case "north" |
1079 pos = "center top"; | |
1080 case "south" | |
1081 pos = "center bottom"; | |
1082 case "east" | |
1083 pos = "right center"; | |
1084 case "west" | |
1085 pos = "left center"; | |
1086 case "northeast" | |
1087 pos = "right top"; | |
1088 case "northwest" | |
1089 pos = "left top"; | |
1090 case "southeast" | |
1091 pos = "right bottom"; | |
1092 case "southwest" | |
1093 pos = "left bottom"; | |
1094 case "best" | |
1095 pos = ""; | |
1096 warning ("legend: 'Best' not yet implemented for location specifier.\n"); | |
1097 ## least conflict with data in plot | |
1098 ## least unused space outside plot | |
6405 | 1099 otherwise |
1100 pos = ""; | |
1101 endswitch | |
1102 fprintf (plot_stream, "set key %s %s %s;\n", inout, pos, box); | |
1103 else | |
1104 fputs (plot_stream, "unset key;\n"); | |
1105 endif | |
1106 | |
1107 fputs (plot_stream, "set style data lines;\n"); | |
1108 | |
1109 if (! use_gnuplot_for_images) | |
1110 for i = 1:ximg_data_idx | |
1111 view_fcn (xlim, ylim, ximg_data{i}, view_zoom, view_cmd); | |
1112 endfor | |
1113 endif | |
1114 | |
7189 | 1115 if (length(cmap) > 0) |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1116 fprintf (plot_stream, |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1117 "set palette positive color model RGB maxcolors %i;\n", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1118 cmap_sz); |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1119 fprintf (plot_stream, |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1120 "set palette file \"-\" binary record=%d using 1:2:3:4;\n", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1121 cmap_sz); |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1122 fwrite (plot_stream, [1:cmap_sz; cmap.'], "float32"); |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1123 fwrite (plot_stream, "\n"); |
7189 | 1124 endif |
8208 | 1125 |
1126 fputs (plot_stream, "unset colorbox;\n"); | |
7189 | 1127 |
6405 | 1128 if (have_data) |
1129 if (nd == 2) | |
1130 plot_cmd = "plot"; | |
1131 else | |
1132 plot_cmd = "splot"; | |
1133 rot_x = 90 - axis_obj.view(2); | |
1134 rot_z = axis_obj.view(1); | |
1135 while (rot_z < 0) | |
1136 rot_z += 360; | |
1137 endwhile | |
6461 | 1138 fputs (plot_stream, "set ticslevel 0;\n"); |
7271 | 1139 if (view_map && rot_x == 0 && rot_z == 0) |
1140 fputs (plot_stream, "set view map;\n"); | |
1141 else | |
1142 fprintf (plot_stream, "set view %.15g, %.15g;\n", rot_x, rot_z); | |
1143 endif | |
6405 | 1144 endif |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
1145 fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s \\\n", plot_cmd, |
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
1146 usingclause{1}, titlespec{1}, withclause{1}); |
6405 | 1147 for i = 2:data_idx |
8218
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
1148 fprintf (plot_stream, ", \"-\" binary format='%%float64' %s %s %s \\\n", |
8a5fbd656f55
make previous change work for surface plots
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8217
diff
changeset
|
1149 usingclause{i}, titlespec{i}, withclause{i}); |
6405 | 1150 endfor |
1151 fputs (plot_stream, ";\n"); | |
1152 for i = 1:data_idx | |
6464 | 1153 if (is_image_data(i)) |
1154 fwrite (plot_stream, data{i}, "float32"); | |
1155 else | |
7119 | 1156 __gnuplot_write_data__ (plot_stream, data{i}, nd, parametric(i), |
1157 have_cdata(i)); | |
6405 | 1158 endif |
1159 endfor | |
6431 | 1160 else |
1161 fputs (plot_stream, "plot \"-\";\nInf Inf\ne\n"); | |
6405 | 1162 endif |
1163 | |
7271 | 1164 ## Needed to allow mouse rotation with pcolor |
1165 if (view_map) | |
1166 fputs (plot_stream, "unset view;\n"); | |
1167 endif | |
1168 | |
6405 | 1169 fflush (plot_stream); |
1170 | |
1171 else | |
1172 print_usage (); | |
7109 | 1173 endif |
6405 | 1174 |
1175 endfunction | |
1176 | |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1177 function [style, typ, with] = do_linestyle_command (obj, idx, mono, |
7513
05eb3486f650
__stepimp__: don't call subplot for single plot
John W. Eaton <jwe@octave.org>
parents:
7510
diff
changeset
|
1178 plot_stream, errbars = "") |
6405 | 1179 |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1180 fprintf (plot_stream, "set style line %d default;\n", idx); |
6405 | 1181 fprintf (plot_stream, "set style line %d", idx); |
1182 | |
1183 found_style = false; | |
6425 | 1184 typ = NaN; |
6465 | 1185 with = ""; |
6405 | 1186 |
6425 | 1187 if (isfield (obj, "color")) |
6405 | 1188 color = obj.color; |
1189 if (isnumeric (color)) | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1190 if (! mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1191 fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1192 round (255*color)); |
6425 | 1193 endif |
6405 | 1194 endif |
1195 found_style = true; | |
1196 endif | |
1197 | |
1198 if (isfield (obj, "linestyle")) | |
1199 switch (obj.linestyle) | |
1200 case "-" | |
6415 | 1201 lt = "1"; |
6405 | 1202 case "--" |
6415 | 1203 lt = "2"; |
6405 | 1204 case ":" |
6415 | 1205 lt = "3"; |
6405 | 1206 case "-." |
6415 | 1207 lt = "6"; |
6405 | 1208 case "none" |
1209 lt = ""; | |
1210 otherwise | |
1211 lt = ""; | |
1212 endswitch | |
6843 | 1213 |
1214 ## FIXME -- linetype is currently broken, since it disables the | |
1215 ## gnuplot default dashed and solid linestyles with the only | |
1216 ## benefit of being able to specify '--' and get a single sized | |
1217 ## dashed line of identical dash pattern for all called this way. | |
1218 ## All dash patterns are a subset of "with lines" and none of the | |
1219 ## lt specifications will correctly propagate into the x11 terminal | |
1220 ## or the print command. Therefore, it is currently disabled in | |
1221 ## order to allow print (..., "-dashed") etc. to work correctly. | |
1222 | |
1223 ## if (! isempty (lt)) | |
1224 ## fprintf (plot_stream, " linetype %s", lt); | |
1225 ## found_style = true; | |
1226 ## endif | |
1227 | |
6405 | 1228 else |
1229 lt = ""; | |
1230 endif | |
1231 | |
1232 if (isfield (obj, "linewidth")) | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1233 fprintf (plot_stream, " linewidth %f", obj.linewidth); |
6405 | 1234 found_style = true; |
1235 endif | |
1236 | |
1237 if (isfield (obj, "marker")) | |
1238 switch (obj.marker) | |
1239 case "+" | |
1240 pt = "1"; | |
1241 case "o" | |
6413 | 1242 pt = "6"; |
6405 | 1243 case "*" |
1244 pt = "3"; | |
1245 case "." | |
7078 | 1246 pt = "0"; |
6405 | 1247 case "x" |
1248 pt = "2"; | |
1249 case {"square", "s"} | |
1250 pt = "5"; | |
1251 case {"diamond", "d"} | |
1252 pt = "13"; | |
1253 case "^" | |
1254 pt = "9"; | |
1255 case "v" | |
1256 pt = "11"; | |
1257 case ">" | |
1258 pt = "8"; | |
1259 case "<" | |
1260 pt = "10"; | |
1261 case {"pentagram", "p"} | |
1262 pt = "4"; | |
1263 case {"hexagram", "h"} | |
6413 | 1264 pt = "12"; |
6405 | 1265 case "none" |
1266 pt = ""; | |
1267 otherwise | |
1268 pt = ""; | |
1269 endswitch | |
1270 if (! isempty (pt)) | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1271 fprintf (plot_stream, " pointtype %s", pt); |
6405 | 1272 found_style = true; |
1273 endif | |
1274 else | |
1275 pt = ""; | |
1276 endif | |
1277 | |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1278 if (isempty (errbars)) |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1279 style = "lines"; |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1280 if (isempty (lt)) |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1281 if (! isempty (pt)) |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1282 style = "points"; |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1283 endif |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1284 elseif (! isempty (pt)) |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1285 style = "linespoints"; |
6405 | 1286 endif |
1287 | |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1288 if (isfield (obj, "markersize")) |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1289 fprintf (plot_stream, " pointsize %f", obj.markersize / 6); |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1290 found_style = true; |
6465 | 1291 endif |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1292 else |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1293 style = errbars; |
6465 | 1294 found_style = true; |
1295 endif | |
1296 | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1297 if (! found_style) |
6405 | 1298 fputs (plot_stream, " default"); |
1299 endif | |
1300 | |
1301 fputs (plot_stream, ";\n"); | |
1302 | |
1303 endfunction | |
6510 | 1304 |
7316 | 1305 function nd = __calc_dimensions__ (obj) |
1306 kids = obj.children; | |
1307 nd = 2; | |
1308 for i = 1:length (kids) | |
1309 obj = get (kids(i)); | |
1310 switch (obj.type) | |
1311 case {"image", "text"} | |
1312 ## ignore as they | |
1313 case {"line", "patch"} | |
1314 if (! isempty (obj.zdata)) | |
1315 nd = 3; | |
1316 endif | |
1317 case "surface" | |
1318 nd = 3; | |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1319 case "hggroup" |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1320 obj_nd = __calc_dimensions__ (obj); |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1321 if (obj_nd == 3) |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1322 nd = 3; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1323 endif |
7316 | 1324 endswitch |
1325 endfor | |
1326 endfunction | |
1327 | |
7119 | 1328 function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata) |
6510 | 1329 |
1330 ## DATA is already transposed. | |
1331 | |
1332 ## FIXME -- this may need to be converted to C++ for speed. | |
1333 | |
6605 | 1334 ## Convert NA elements to normal NaN values because fprintf writes |
1335 ## "NA" and that confuses gnuplot. | |
1336 idx = find (isna (data)); | |
1337 if (any (idx)) | |
1338 data(idx) = NaN; | |
1339 endif | |
1340 | |
6510 | 1341 if (nd == 2) |
8217
f74cb5e3a6c1
send binary data to gnuplot
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8216
diff
changeset
|
1342 fwrite (plot_stream, data, "float64"); |
7109 | 1343 elseif (nd == 3) |
6510 | 1344 if (parametric) |
8217
f74cb5e3a6c1
send binary data to gnuplot
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8216
diff
changeset
|
1345 fwrite (plot_stream, data, "float64"); |
6510 | 1346 else |
7170 | 1347 nr = rows (data); |
7119 | 1348 if (cdata) |
7170 | 1349 for j = 1:4:nr |
8217
f74cb5e3a6c1
send binary data to gnuplot
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8216
diff
changeset
|
1350 fwrite (plot_stream, data(j:j+3,:), "float64"); |
7119 | 1351 endfor |
1352 else | |
7170 | 1353 for j = 1:3:nr |
8217
f74cb5e3a6c1
send binary data to gnuplot
Daniel J. Sebald <daniel.sebald@ieee.org>
parents:
8216
diff
changeset
|
1354 fwrite (plot_stream, data(j:j+2,:), "float64"); |
7119 | 1355 endfor |
1356 endif | |
7109 | 1357 endif |
6510 | 1358 endif |
1359 | |
1360 endfunction | |
6745 | 1361 |
7269 | 1362 function do_tics (obj, plot_stream, ymirror, mono) |
6809 | 1363 if (strcmpi (obj.xaxislocation, "top")) |
1364 do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, | |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1365 obj.xcolor, "x2", plot_stream, true, mono, "border", |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1366 obj.tickdir); |
6809 | 1367 do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1368 obj.xcolor, "x", plot_stream, true, mono, "border", ""); |
7321 | 1369 elseif (strcmpi (obj.xaxislocation, "zero")) |
1370 do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, | |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1371 obj.xcolor, "x", plot_stream, true, mono, "axis", |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1372 obj.tickdir); |
7321 | 1373 do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1374 obj.xcolor, "x2", plot_stream, true, mono, "axis", ""); |
6809 | 1375 else |
1376 do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, | |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1377 obj.xcolor, "x", plot_stream, true, mono, "border", |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1378 obj.tickdir); |
6809 | 1379 do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1380 obj.xcolor, "x2", plot_stream, true, mono, "border", ""); |
6809 | 1381 endif |
1382 if (strcmpi (obj.yaxislocation, "right")) | |
1383 do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, | |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1384 obj.ycolor, "y2", plot_stream, ymirror, mono, "border", |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1385 obj.tickdir); |
6809 | 1386 do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1387 obj.ycolor, "y", plot_stream, ymirror, mono, "border", ""); |
7321 | 1388 elseif (strcmpi (obj.xaxislocation, "zero")) |
1389 do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, | |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1390 obj.ycolor, "y", plot_stream, ymirror, mono, "axis", |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1391 obj.tickdir); |
7321 | 1392 do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1393 obj.ycolor, "y2", plot_stream, ymirror, mono, "axis", ""); |
6809 | 1394 else |
1395 do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, | |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1396 obj.ycolor, "y", plot_stream, ymirror, mono, "border", |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1397 obj.tickdir); |
6809 | 1398 do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1399 obj.ycolor, "y2", plot_stream, ymirror, mono, "border", ""); |
6809 | 1400 endif |
6745 | 1401 do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel, |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1402 obj.zcolor, "z", plot_stream, true, mono, "border", |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1403 obj.tickdir); |
6745 | 1404 endfunction |
1405 | |
7269 | 1406 function do_tics_1 (ticmode, tics, labelmode, labels, color, ax, |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1407 plot_stream, mirror, mono, axispos, tickdir) |
7269 | 1408 colorspec = get_text_colorspec (color, mono); |
8112
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1409 if (strcmpi (ticmode, "manual") || strcmpi (labelmode, "manual")) |
6745 | 1410 if (isempty (tics)) |
1411 fprintf (plot_stream, "unset %stics;\n", ax); | |
6758 | 1412 elseif (strcmpi (labelmode, "manual") && ! isempty (labels)) |
6751 | 1413 if (ischar (labels)) |
1414 labels = cellstr (labels); | |
1415 endif | |
6745 | 1416 if (iscellstr (labels)) |
6751 | 1417 k = 1; |
1418 ntics = numel (tics); | |
1419 nlabels = numel (labels); | |
6745 | 1420 fprintf (plot_stream, "set format %s \"%%s\";\n", ax); |
7206 | 1421 if (mirror) |
8112
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1422 fprintf (plot_stream, "set %stics %s %s mirror (", ax, |
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1423 tickdir, axispos); |
7206 | 1424 else |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1425 fprintf (plot_stream, "set %stics %s %s nomirror (", ax, |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1426 tickdir, axispos); |
7206 | 1427 endif |
7228 | 1428 labels = regexprep(labels, "%", "%%"); |
6745 | 1429 for i = 1:ntics |
8112
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1430 fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i)); |
6745 | 1431 if (i < ntics) |
1432 fputs (plot_stream, ", "); | |
1433 endif | |
1434 if (k > nlabels) | |
1435 k = 1; | |
1436 endif | |
1437 endfor | |
7220 | 1438 fprintf (plot_stream, ") %s;\n", colorspec); |
6745 | 1439 else |
1440 error ("unsupported type of ticklabel"); | |
1441 endif | |
1442 else | |
6920 | 1443 fprintf (plot_stream, "set format %s \"%%g\";\n", ax); |
7206 | 1444 if (mirror) |
8112
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1445 fprintf (plot_stream, "set %stics %s %s mirror (", ax, tickdir, |
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1446 axispos); |
7206 | 1447 else |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1448 fprintf (plot_stream, "set %stics %s %s nomirror (", ax, tickdir, |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1449 axispos); |
7206 | 1450 endif |
8112
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1451 fprintf (plot_stream, " %.15g,", tics(1:end-1)); |
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1452 fprintf (plot_stream, " %.15g);\n", tics(end)); |
6745 | 1453 endif |
1454 else | |
6920 | 1455 fprintf (plot_stream, "set format %s \"%%g\";\n", ax); |
7206 | 1456 if (mirror) |
8208 | 1457 fprintf (plot_stream, "set %stics %s %s mirror %s;\n", ax, |
1458 axispos, tickdir, colorspec); | |
7206 | 1459 else |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1460 fprintf (plot_stream, "set %stics %s %s nomirror %s;\n", ax, |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1461 tickdir, axispos, colorspec); |
7206 | 1462 endif |
7194 | 1463 endif |
1464 endfunction | |
1465 | |
7269 | 1466 function colorspec = get_text_colorspec (color, mono) |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1467 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1468 colorspec = ""; |
7194 | 1469 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1470 colorspec = sprintf ("textcolor rgb \"#%02x%02x%02x\"", |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1471 round (255*color)); |
6745 | 1472 endif |
1473 endfunction | |
7163 | 1474 |
7189 | 1475 function [f, s, fnt, it, bld] = get_fontname_and_size (t) |
7163 | 1476 if (isempty (t.fontname)) |
7372 | 1477 fnt = "Helvetica"; |
7163 | 1478 else |
7372 | 1479 fnt = t.fontname; |
7168 | 1480 endif |
7189 | 1481 f = fnt; |
1482 it = false; | |
1483 bld = false; | |
7372 | 1484 if (! isempty (t.fontweight) && strcmpi (t.fontweight, "bold")) |
7168 | 1485 if (! isempty(t.fontangle) |
7372 | 1486 && (strcmpi (t.fontangle, "italic") |
1487 || strcmpi (t.fontangle, "oblique"))) | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1488 f = cstrcat (f, "-bolditalic"); |
7189 | 1489 it = true; |
1490 bld = true; | |
7168 | 1491 else |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1492 f = cstrcat (f, "-bold"); |
7189 | 1493 bld = true; |
7168 | 1494 endif |
1495 elseif (! isempty(t.fontangle) | |
7372 | 1496 && (strcmpi (t.fontangle, "italic") |
1497 || strcmpi (t.fontangle, "oblique"))) | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1498 f = cstrcat (f, "-italic"); |
7189 | 1499 it = true; |
7163 | 1500 endif |
1501 if (isempty (t.fontsize)) | |
1502 s = 10; | |
1503 else | |
1504 s = t.fontsize; | |
1505 endif | |
1506 endfunction | |
7189 | 1507 |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1508 function [str, f, s] = __maybe_munge_text__ (enhanced, obj, fld) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1509 |
7189 | 1510 persistent warned_latex = false; |
1511 | |
1512 if (strcmp (fld, "string")) | |
1513 [f, s, fnt, it, bld] = get_fontname_and_size (obj); | |
1514 else | |
7372 | 1515 f = "Helvetica"; |
7189 | 1516 s = 10; |
1517 fnt = f; | |
1518 it = false; | |
1519 bld = false; | |
1520 endif | |
1521 | |
1522 str = getfield (obj, fld); | |
1523 if (enhanced) | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
1524 if (strcmpi (obj.interpreter, "tex")) |
7189 | 1525 str = __tex2enhanced__ (str, fnt, it, bld); |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
1526 elseif (strcmpi (obj.interpreter, "latex")) |
7189 | 1527 if (! warned_latex) |
1528 warning ("latex text objects not supported"); | |
1529 warned_latex = true; | |
1530 endif | |
1531 endif | |
1532 endif | |
1533 endfunction | |
1534 | |
1535 function str = __tex2enhanced__ (str, fnt, it, bld) | |
1536 persistent sym = __setup_sym_table__ (); | |
1537 persistent flds = fieldnames (sym); | |
1538 | |
1539 [s, e, m] = regexp(str,'\\([a-zA-Z]+|0)','start','end','matches'); | |
1540 | |
1541 for i = length (s) : -1 : 1 | |
1542 ## special case for "\0" and replace with "{/Symbol \306}' | |
1543 if (strncmp (m{i}, '\0', 2)) | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1544 str = cstrcat (str(1:s(i) - 1), '{/Symbol \306}', str(s(i) + 2:end)); |
7189 | 1545 else |
1546 f = m{i}(2:end); | |
1547 if (isfield (sym, f)) | |
1548 g = getfield(sym, f); | |
1549 ## FIXME The symbol font doesn't seem to support bold or italic | |
1550 ##if (bld) | |
1551 ## if (it) | |
1552 ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); | |
1553 ## else | |
1554 ## g = regexprep (g, '/Symbol', '/Symbol-bold'); | |
1555 ## endif | |
1556 ##elseif (it) | |
1557 ## g = regexprep (g, '/Symbol', '/Symbol-italic'); | |
1558 ##endif | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1559 str = cstrcat (str(1:s(i) - 1), g, str(e(i) + 1:end)); |
7189 | 1560 elseif (strncmp (f, "rm", 2)) |
1561 bld = false; | |
1562 it = false; | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1563 str = cstrcat (str(1:s(i) - 1), '/', fnt, ' ', str(s(i) + 3:end)); |
7189 | 1564 elseif (strncmp (f, "it", 2) || strncmp (f, "sl", 2)) |
1565 it = true; | |
1566 if (bld) | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1567 str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', |
7189 | 1568 str(s(i) + 3:end)); |
1569 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1570 str = cstrcat (str(1:s(i) - 1), '/', fnt, '-italic ', |
7189 | 1571 str(s(i) + 3:end)); |
1572 endif | |
1573 elseif (strncmp (f, "bf", 2)) | |
1574 bld = true; | |
1575 if (it) | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1576 str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', |
7189 | 1577 str(2(i) + 3:end)); |
1578 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1579 str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bold ', |
7189 | 1580 str(s(i) + 3:end)); |
1581 endif | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
1582 elseif (strcmpi (f, "color")) |
7189 | 1583 ## FIXME Ignore \color but remove trailing {} block as well |
1584 d = strfind(str(e(i) + 1:end),'}'); | |
1585 if (isempty (d)) | |
1586 warning ('syntax error in \color argument'); | |
1587 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1588 str = cstrcat (str(1:s(i) - 1), str(e(i) + d + 1:end)); |
7189 | 1589 endif |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
1590 elseif(strcmpi (f, "fontname")) |
7189 | 1591 b1 = strfind(str(e(i) + 1:end),'{'); |
1592 b2 = strfind(str(e(i) + 1:end),'}'); | |
1593 if (isempty(b1) || isempty(b2)) | |
1594 warning ('syntax error in \fontname argument'); | |
1595 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1596 str = cstrcat (str(1:s(i) - 1), '/', |
7189 | 1597 str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', |
1598 str(e(i) + b2(1) + 1:end)); | |
1599 endif | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
1600 elseif(strcmpi (f, "fontsize")) |
7189 | 1601 b1 = strfind(str(e(i) + 1:end),'{'); |
1602 b2 = strfind(str(e(i) + 1:end),'}'); | |
1603 if (isempty(b1) || isempty(b2)) | |
1604 warning ('syntax error in \fontname argument'); | |
1605 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1606 str = cstrcat (str(1:s(i) - 1), '/=', |
7189 | 1607 str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', |
1608 str(e(i) + b2(1) + 1:end)); | |
1609 endif | |
1610 else | |
1611 ## Last desperate attempt to treat the symbol. Look for things | |
1612 ## like \pix, that should be translated to the symbol Pi and x | |
1613 for j = 1 : length (flds) | |
1614 if (strncmp (flds{j}, f, length (flds{j}))) | |
1615 g = getfield(sym, flds{j}); | |
1616 ## FIXME The symbol font doesn't seem to support bold or italic | |
1617 ##if (bld) | |
1618 ## if (it) | |
1619 ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); | |
1620 ## else | |
1621 ## g = regexprep (g, '/Symbol', '/Symbol-bold'); | |
1622 ## endif | |
1623 ##elseif (it) | |
1624 ## g = regexprep (g, '/Symbol', '/Symbol-italic'); | |
1625 ##endif | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1626 str = cstrcat (str(1:s(i) - 1), g, |
7189 | 1627 str(s(i) + length (flds{j}) + 1:end)); |
1628 break; | |
1629 endif | |
1630 endfor | |
1631 endif | |
1632 endif | |
1633 endfor | |
1634 | |
1635 ## Prepend @ to things things like _0^x or _{-100}^{100} for alignment | |
1636 ## But need to put the shorter of the two arguments first. Carful of | |
1637 ## nested {} and unprinted characters when defining shortest.. Don't | |
1638 ## have to worry about things like ^\theta as they are already converted to | |
1639 ## ^{/Symbol q}. | |
1640 | |
1641 ## FIXME.. This is a mess... Is it worth it just for a "@" character? | |
1642 | |
1643 [s, m] = regexp(str,'[_\^]','start','matches'); | |
1644 i = 1; | |
1645 p = 0; | |
1646 while (i < length (s)) | |
1647 if (i < length(s)) | |
1648 if (str(s(i) + p + 1) == "{") | |
1649 s1 = strfind(str(s(i) + p + 2:end),'{'); | |
1650 si = 1; | |
1651 l1 = strfind(str(s(i) + p + 1:end),'}'); | |
1652 li = 1; | |
1653 while (li <= length (l1) && si <= length (s1)) | |
1654 if (l1(li) < s1(si)) | |
1655 if (li == si) | |
1656 break; | |
1657 endif | |
1658 li++; | |
1659 else | |
1660 si++; | |
1661 endif | |
1662 endwhile | |
1663 l1 = l1 (min (length(l1), si)); | |
1664 if (s(i) + l1 + 1 == s(i+1)) | |
1665 if (str(s(i + 1) + p + 1) == "{") | |
1666 s2 = strfind(str(s(i + 1) + p + 2:end),'{'); | |
1667 si = 1; | |
1668 l2 = strfind(str(s(i + 1) + p + 1:end),'}'); | |
1669 li = 1; | |
1670 while (li <= length (l2) && si <= length (s2)) | |
1671 if (l2(li) < s2(si)) | |
1672 if (li == si) | |
1673 break; | |
1674 endif | |
1675 li++; | |
1676 else | |
1677 si++; | |
1678 endif | |
1679 endwhile | |
1680 l2 = l2 (min (length(l2), si)); | |
1681 if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <= | |
1682 length_string(str(s(i+1)+p+2:s(i+1)+p+l2-1))) | |
1683 ## shortest already first! | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1684 str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end)); |
7189 | 1685 else |
1686 ## Have to swap sub/super-script to get shortest first | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1687 str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2), |
7189 | 1688 str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end)); |
1689 endif | |
1690 else | |
1691 ## Have to swap sub/super-script to get shortest first | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1692 str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1), |
7189 | 1693 str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end)); |
1694 endif | |
1695 i += 2; | |
1696 p ++; | |
1697 else | |
1698 i++; | |
1699 endif | |
1700 else | |
1701 if (s(i+1) == s(i) + 2) | |
1702 ## shortest already first! | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1703 str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end)); |
7189 | 1704 p ++; |
1705 i += 2; | |
1706 else | |
1707 i ++; | |
1708 endif | |
1709 endif | |
1710 else | |
1711 i ++; | |
1712 endif | |
1713 endwhile | |
1714 | |
1715 endfunction | |
1716 | |
1717 function l = length_string (s) | |
1718 l = length (s) - length (strfind(s,'{')) - length (strfind(s,'}')); | |
1719 m = regexp (s, '/([\w\-]+|[\w\-]+=\d+)', 'matches'); | |
1720 if (!isempty (m)) | |
1721 l = l - sum (cellfun (@length, m)); | |
1722 endif | |
1723 endfunction | |
1724 | |
1725 function sym = __setup_sym_table__ () | |
1726 ## Setup the translation table for TeX to gnuplot enhanced mode. | |
1727 sym.forall = '{/Symbol \042}'; | |
1728 sym.exists = '{/Symbol \044}'; | |
1729 sym.ni = '{/Symbol \047}'; | |
1730 sym.cong = '{/Symbol \100}'; | |
1731 sym.Delta = '{/Symbol D}'; | |
1732 sym.Phi = '{/Symbol F}'; | |
7608
49810341db91
Correct typos in __go_draw_axes__.m and update Manual
godfrey@qss.Stanford.EDU
parents:
7603
diff
changeset
|
1733 sym.Gamma = '{/Symbol G}'; |
7190 | 1734 sym.vartheta = '{/Symbol J}'; |
7189 | 1735 sym.Lambda = '{/Symbol L}'; |
1736 sym.Pi = '{/Symbol P}'; | |
1737 sym.Theta = '{/Symbol Q}'; | |
1738 sym.Sigma = '{/Symbol S}'; | |
1739 sym.varsigma = '{/Symbol V}'; | |
7420 | 1740 sym.Omega = '{/Symbol W}'; |
7189 | 1741 sym.Xi = '{/Symbol X}'; |
1742 sym.Psi = '{/Symbol Y}'; | |
1743 sym.perp = '{/Symbol \136}'; | |
1744 sym.alpha = '{/Symbol a}'; | |
1745 sym.beta = '{/Symbol b}'; | |
1746 sym.chi = '{/Symbol c}'; | |
1747 sym.delta = '{/Symbol d}'; | |
1748 sym.epsilon = '{/Symbol e}'; | |
1749 sym.phi = '{/Symbol f}'; | |
7608
49810341db91
Correct typos in __go_draw_axes__.m and update Manual
godfrey@qss.Stanford.EDU
parents:
7603
diff
changeset
|
1750 sym.gamma = '{/Symbol g}'; |
7189 | 1751 sym.eta = '{/Symbol h}'; |
1752 sym.iota = '{/Symbol i}'; | |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1753 sym.varphi = '{/Symbol j}'; |
7189 | 1754 sym.kappa = '{/Symbol k}'; |
1755 sym.lambda = '{/Symbol l}'; | |
1756 sym.mu = '{/Symbol m}'; | |
1757 sym.nu = '{/Symbol n}'; | |
1758 sym.o = '{/Symbol o}'; | |
1759 sym.pi = '{/Symbol p}'; | |
1760 sym.theta = '{/Symbol q}'; | |
1761 sym.rho = '{/Symbol r}'; | |
1762 sym.sigma = '{/Symbol s}'; | |
1763 sym.tau = '{/Symbol t}'; | |
1764 sym.upsilon = '{/Symbol u}'; | |
1765 sym.varpi = '{/Symbol v}'; | |
1766 sym.omega = '{/Symbol w}'; | |
1767 sym.xi = '{/Symbol x}'; | |
1768 sym.psi = '{/Symbol y}'; | |
1769 sym.zeta = '{/Symbol z}'; | |
1770 sym.sim = '{/Symbol \176}'; | |
1771 sym.Upsilon = '{/Symbol \241}'; | |
1772 sym.prime = '{/Symbol \242}'; | |
1773 sym.leq = '{/Symbol \243}'; | |
1774 sym.infty = '{/Symbol \245}'; | |
1775 sym.clubsuit = '{/Symbol \247}'; | |
1776 sym.diamondsuit = '{/Symbol \250}'; | |
1777 sym.heartsuit = '{/Symbol \251}'; | |
1778 sym.spadesuit = '{/Symbol \252}'; | |
1779 sym.leftrightarrow = '{/Symbol \253}'; | |
1780 sym.leftarrow = '{/Symbol \254}'; | |
1781 sym.uparrow = '{/Symbol \255}'; | |
1782 sym.rightarrow = '{/Symbol \256}'; | |
1783 sym.downarrow = '{/Symbol \257}'; | |
1784 sym.circ = '{/Symbol \260}'; | |
1785 sym.pm = '{/Symbol \261}'; | |
1786 sym.geq = '{/Symbol \263}'; | |
1787 sym.times = '{/Symbol \264}'; | |
1788 sym.propto = '{/Symbol \265}'; | |
1789 sym.partial = '{/Symbol \266}'; | |
1790 sym.bullet = '{/Symbol \267}'; | |
1791 sym.div = '{/Symbol \270}'; | |
1792 sym.neq = '{/Symbol \271}'; | |
1793 sym.equiv = '{/Symbol \272}'; | |
1794 sym.approx = '{/Symbol \273}'; | |
1795 sym.ldots = '{/Symbol \274}'; | |
1796 sym.mid = '{/Symbol \275}'; | |
1797 sym.aleph = '{/Symbol \300}'; | |
1798 sym.Im = '{/Symbol \301}'; | |
1799 sym.Re = '{/Symbol \302}'; | |
1800 sym.wp = '{/Symbol \303}'; | |
1801 sym.otimes = '{/Symbol \304}'; | |
1802 sym.oplus = '{/Symbol \305}'; | |
1803 sym.oslash = '{/Symbol \306}'; | |
1804 sym.cap = '{/Symbol \307}'; | |
1805 sym.cup = '{/Symbol \310}'; | |
1806 sym.supset = '{/Symbol \311}'; | |
1807 sym.supseteq = '{/Symbol \312}'; | |
1808 sym.subset = '{/Symbol \314}'; | |
1809 sym.subseteq = '{/Symbol \315}'; | |
1810 sym.in = '{/Symbol \316}'; | |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1811 sym.notin = '{/Symbol \317}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1812 sym.angle = '{/Symbol \320}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1813 sym.bigtriangledown = '{/Symbol \321}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1814 sym.langle = '{/Symbol \341}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1815 sym.rangle = '{/Symbol \361}'; |
7189 | 1816 sym.nabla = '{/Symbol \321}'; |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1817 sym.prod = '{/Symbol \325}'; |
7189 | 1818 sym.surd = '{/Symbol \326}'; |
1819 sym.cdot = '{/Symbol \327}'; | |
1820 sym.neg = '{/Symbol \330}'; | |
1821 sym.wedge = '{/Symbol \331}'; | |
1822 sym.vee = '{/Symbol \332}'; | |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1823 sym.Leftrightarrow = '{/Symbol \333}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1824 sym.Leftarrow = '{/Symbol \334}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1825 sym.Uparrow = '{/Symbol \335}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1826 sym.Rightarrow = '{/Symbol \336}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1827 sym.Downarrow = '{/Symbol \337}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1828 sym.diamond = '{/Symbol \340}'; |
7189 | 1829 sym.copyright = '{/Symbol \343}'; |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1830 sym.lfloor = '{/Symbol \353}'; |
7189 | 1831 sym.lceil = '{/Symbol \351}'; |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1832 sym.rfloor = '{/Symbol \373}'; |
7189 | 1833 sym.rceil = '{/Symbol \371}'; |
1834 sym.int = '{/Symbol \362}'; | |
1835 endfunction | |
1836 | |
7390 | 1837 function retval = __do_enhanced_option__ (enhanced, obj) |
1838 retval = ""; | |
1839 if (enhanced) | |
1840 if (strcmpi (obj.interpreter, "none")) | |
1841 retval = "noenhanced"; | |
1842 else | |
1843 retval = "enhanced"; | |
1844 endif | |
1845 endif | |
1846 endfunction | |
7542
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1847 |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1848 function typ = get_old_gnuplot_color (color) |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1849 if (isequal (color, [0, 0, 0])) |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1850 typ = -1; |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1851 elseif (isequal (color, [1, 0, 0])) |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1852 typ = 1; |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1853 elseif (isequal (color, [0, 1, 0])) |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1854 typ = 2; |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1855 elseif (isequal (color, [0, 0, 1])) |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1856 typ = 3; |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1857 elseif (isequal (color, [1, 0, 1])) |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1858 typ = 4; |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1859 elseif (isequal (color, [0, 1, 1])) |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1860 typ = 5; |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1861 elseif (isequal (color, [1, 1, 1])) |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1862 typ = -1; |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1863 elseif (isequal (color, [1, 1, 0])) |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1864 typ = 7; |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1865 else |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1866 typ = -1; |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1867 endif |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1868 endfunction |