Mercurial > hg > octave-nkf
annotate scripts/plot/__go_draw_axes__.m @ 8208:f6ca8ff51818
[mq]: graphics-backend
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 10 Oct 2008 11:07:53 -0400 |
parents | 73d6b71788c0 |
children | 5d6b9311be38 |
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 |
385 usingclause{data_idx} = ""; | |
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]'; |
396 usingclause{data_idx} = "using ($1):($2):($3)"; | |
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]'; |
443 usingclause{data_idx} = "using ($1):($2):($3):($4):($5):($6)"; | |
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]'; | |
447 usingclause{data_idx} = "using ($1):($2):($3):($4)"; | |
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]'; |
462 usingclause{data_idx} = "using ($1):($2):($3):($4)"; | |
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]'; | |
6809 | 466 usingclause{data_idx} = sprintf ("using ($1):($2) axes %s%s", |
467 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 |
523 usingclause{data_idx} = ""; | |
7189 | 524 if (isfield (obj, "facecolor")) |
525 if ((strncmp (obj.facecolor, "flat", 4) | |
7284 | 526 || strncmp (obj.facecolor, "interp", 6)) |
527 && isfield (obj, "cdata")) | |
7170 | 528 if (ndims (obj.cdata) == 2 |
7189 | 529 && (size (obj.cdata, 2) == nc |
530 && (size (obj.cdata, 1) == 1 | |
531 || size (obj.cdata, 1) == 3))) | |
532 ccol = cdat (:, i); | |
533 elseif (ndims (obj.cdata) == 2 | |
534 && (size (obj.cdata, 1) == nc | |
535 && (size (obj.cdata, 2) == 1 | |
536 || size (obj.cdata, 2) == 3))) | |
537 ccol = cdat (i, :); | |
7170 | 538 elseif (ndims (obj.cdata) == 3) |
7189 | 539 ccol = permute (cdat (:, i, :), [1, 3, 2]); |
7170 | 540 else |
7189 | 541 ccol = cdat; |
7170 | 542 endif |
543 if (strncmp (obj.facecolor, "flat", 4)) | |
544 if (numel(ccol) == 3) | |
545 color = ccol; | |
546 else | |
7226 | 547 r = 1 + round ((size (cmap, 1) - 1) |
548 * (ccol - clim(1))/(clim(2) - clim(1))); | |
7170 | 549 r = max (1, min (r, size (cmap, 1))); |
550 color = cmap(r, :); | |
551 endif | |
552 elseif (strncmp (obj.facecolor, "interp", 6)) | |
7582 | 553 warning ("\"interp\" not supported, using 1st entry of cdata"); |
7170 | 554 r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); |
555 r = max (1, min (r, size (cmap, 1))); | |
556 color = cmap(r,:); | |
557 endif | |
7189 | 558 elseif (isnumeric (obj.facecolor)) |
559 color = obj.facecolor; | |
7170 | 560 else |
7189 | 561 color = [0, 1, 0]; |
7170 | 562 endif |
563 else | |
564 color = [0, 1, 0]; | |
565 endif | |
566 | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
567 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
568 colorspec = ""; |
7170 | 569 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
570 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
|
571 round (255*color)); |
7170 | 572 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
573 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
|
574 colorspec); |
7170 | 575 data{data_idx} = [xcol, ycol]'; |
576 usingclause{data_idx} = "using ($1):($2)"; | |
577 endif | |
578 endif | |
579 | |
580 ## patch outline | |
581 if (! strncmp (obj.edgecolor, "none", 4)) | |
582 | |
583 data_idx++; | |
584 is_image_data(data_idx) = false; | |
585 parametric(data_idx) = false; | |
586 have_cdata(data_idx) = false; | |
587 titlespec{data_idx} = "title \"\""; | |
7020 | 588 usingclause{data_idx} = ""; |
7189 | 589 |
590 if (isfield (obj, "markersize")) | |
7564
90536e155fde
adjust markersize by a factor of 1/6
John W. Eaton <jwe@octave.org>
parents:
7542
diff
changeset
|
591 mdat = obj.markersize / 6; |
7189 | 592 endif |
593 | |
594 if (isfield (obj, "edgecolor")) | |
595 if ((strncmp (obj.edgecolor, "flat", 4) | |
7284 | 596 || strncmp (obj.edgecolor, "interp", 6)) |
597 && isfield (obj, "cdata")) | |
7119 | 598 if (ndims (obj.cdata) == 2 |
7189 | 599 && (size (obj.cdata, 2) == nc |
600 && (size (obj.cdata, 1) == 1 | |
601 || size (obj.cdata, 1) == 3))) | |
602 ccol = cdat (:, i); | |
603 elseif (ndims (obj.cdata) == 2 | |
604 && (size (obj.cdata, 1) == nc | |
605 && (size (obj.cdata, 2) == 1 | |
606 || size (obj.cdata, 2) == 3))) | |
607 ccol = cdat (i, :); | |
7020 | 608 elseif (ndims (obj.cdata) == 3) |
7189 | 609 ccol = permute (cdat (:, i, :), [1, 3, 2]); |
7020 | 610 else |
7189 | 611 ccol = cdat; |
7020 | 612 endif |
7170 | 613 if (strncmp (obj.edgecolor, "flat", 4)) |
7189 | 614 if (numel(ccol) == 3) |
7020 | 615 color = ccol; |
616 else | |
7226 | 617 r = 1 + round ((size (cmap, 1) - 1) |
618 * (ccol - clim(1))/(clim(2) - clim(1))); | |
7020 | 619 r = max (1, min (r, size (cmap, 1))); |
620 color = cmap(r, :); | |
621 endif | |
7170 | 622 elseif (strncmp (obj.edgecolor, "interp", 6)) |
7582 | 623 warning ("\"interp\" not supported, using 1st entry of cdata"); |
7020 | 624 r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); |
625 r = max (1, min (r, size (cmap, 1))); | |
626 color = cmap(r,:); | |
627 endif | |
7189 | 628 elseif (isnumeric (obj.edgecolor)) |
629 color = obj.edgecolor; | |
630 else | |
631 color = [0, 0, 0]; | |
7020 | 632 endif |
633 else | |
7189 | 634 color = [0, 0, 0]; |
7020 | 635 endif |
7189 | 636 |
637 if (isfield (obj, "linestyle")) | |
638 switch (obj.linestyle) | |
639 case "-" | |
7317 | 640 lt = "lt 1"; |
7189 | 641 case "--" |
7317 | 642 lt = "lt 2"; |
7189 | 643 case ":" |
7317 | 644 lt = "lt 3"; |
7189 | 645 case "-." |
7317 | 646 lt = "lt 6"; |
7189 | 647 case "none" |
648 lt = ""; | |
649 otherwise | |
650 lt = ""; | |
651 endswitch | |
652 else | |
653 lt = ""; | |
654 endif | |
655 | |
7462
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
656 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
|
657 lw = sprintf("linewidth %f", obj.linewidth); |
7462
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
658 else |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
659 lw = ""; |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
660 endif |
dfcaf7ed48e3
Allow linewidth to be specified for contours
David Bateman
parents:
7420
diff
changeset
|
661 |
7189 | 662 if (isfield (obj, "marker")) |
663 if (isfield (obj, "marker")) | |
664 switch (obj.marker) | |
665 case "+" | |
666 pt = "pt 1"; | |
667 case "o" | |
668 pt = "pt 6"; | |
669 case "*" | |
670 pt = "pt 3"; | |
671 case "." | |
672 pt = "pt 0"; | |
673 case "x" | |
674 pt = "pt 2"; | |
675 case {"square", "s"} | |
676 pt = "pt 5"; | |
677 case {"diamond", "d"} | |
678 pt = "pt 13"; | |
679 case "^" | |
680 pt = "pt 9"; | |
681 case "v" | |
682 pt = "pt 11"; | |
683 case ">" | |
684 pt = "pt 8"; | |
685 case "<" | |
686 pt = "pt 10"; | |
687 case {"pentagram", "p"} | |
688 pt = "pt 4"; | |
689 case {"hexagram", "h"} | |
690 pt = "pt 12"; | |
691 case "none" | |
692 pt = ""; | |
693 otherwise | |
694 pt = ""; | |
695 endswitch | |
696 endif | |
697 else | |
698 pt = ""; | |
699 endif | |
700 | |
701 style = "lines"; | |
702 if (isempty (lt)) | |
703 if (! isempty (pt)) | |
704 style = "points"; | |
705 endif | |
706 elseif (! isempty (pt)) | |
707 style = "linespoints"; | |
708 endif | |
709 | |
710 if (isfield (obj, "markersize")) | |
711 if (length (mdat) == nc) | |
7603
689652eb95d1
fix for scatter markersize
David Bateman <dbateman@free.fr>
parents:
7593
diff
changeset
|
712 m = mdat(i); |
7189 | 713 else |
7603
689652eb95d1
fix for scatter markersize
David Bateman <dbateman@free.fr>
parents:
7593
diff
changeset
|
714 m = mdat; |
7189 | 715 endif |
716 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
|
717 ps = sprintf("pointsize %f", m); |
7189 | 718 else |
719 ps = ""; | |
720 endif | |
721 else | |
722 ps = ""; | |
723 endif | |
724 | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
725 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
726 colorspec = ""; |
7020 | 727 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
728 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
|
729 round (255*color)); |
7020 | 730 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
731 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
|
732 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
|
733 colorspec); |
6790 | 734 |
7316 | 735 if (nd == 3) |
7170 | 736 if (! isnan (xcol) && ! isnan (ycol) && ! isnan (zcol)) |
737 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)], ... | |
738 [zcol; zcol(1)]]'; | |
739 else | |
740 data{data_idx} = [xcol, ycol, zcol]'; | |
741 endif | |
742 usingclause{data_idx} = "using ($1):($2):($3)"; | |
7020 | 743 else |
7170 | 744 if (! isnan (xcol) && ! isnan (ycol)) |
745 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]'; | |
746 else | |
747 data{data_idx} = [xcol, ycol]'; | |
748 endif | |
749 usingclause{data_idx} = "using ($1):($2)"; | |
7020 | 750 endif |
6885 | 751 endif |
7020 | 752 endfor |
6790 | 753 |
6405 | 754 case "surface" |
7271 | 755 view_map = true; |
7110 | 756 if (! (strncmp (obj.edgecolor, "none", 4) |
757 && strncmp (obj.facecolor, "none", 4))) | |
7109 | 758 data_idx++; |
759 is_image_data(data_idx) = false; | |
760 parametric(data_idx) = false; | |
7119 | 761 have_cdata(data_idx) = true; |
7170 | 762 [style, typ, with] = do_linestyle_command (obj, data_idx, |
7269 | 763 mono, plot_stream); |
7109 | 764 if (isempty (obj.keylabel)) |
765 titlespec{data_idx} = "title \"\""; | |
766 else | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
767 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
|
768 titlespec{data_idx} = cstrcat ("title \"", tmp, "\""); |
7109 | 769 endif |
770 usingclause{data_idx} = ""; | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
771 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
|
772 data_idx); |
7109 | 773 |
774 xdat = obj.xdata; | |
775 ydat = obj.ydata; | |
776 zdat = obj.zdata; | |
777 cdat = obj.cdata; | |
7110 | 778 |
7109 | 779 err = false; |
780 if (! size_equal(zdat, cdat)) | |
6405 | 781 err = true; |
7109 | 782 endif |
783 if (isvector (xdat) && isvector (ydat) && ismatrix (zdat)) | |
7110 | 784 if (rows (zdat) == length (ydat) |
785 && columns (zdat) == length (xdat)) | |
7109 | 786 [xdat, ydat] = meshgrid (xdat, ydat); |
787 else | |
788 err = true; | |
789 endif | |
790 elseif (ismatrix (xdat) && ismatrix (ydat) && ismatrix (zdat)) | |
7292 | 791 if (! size_equal (xdat, ydat, zdat)) |
7109 | 792 err = true; |
793 endif | |
794 else | |
795 err = true; | |
796 endif | |
797 if (err) | |
798 error ("__go_draw_axes__: invalid grid data"); | |
6405 | 799 endif |
7109 | 800 xlen = columns (zdat); |
801 ylen = rows (zdat); | |
802 if (xlen == columns (xdat) && xlen == columns (ydat) | |
803 && ylen == rows (xdat) && ylen == rows (ydat)) | |
804 len = 4 * xlen; | |
805 zz = zeros (ylen, len); | |
806 k = 1; | |
807 for kk = 1:4:len | |
808 zz(:,kk) = xdat(:,k); | |
809 zz(:,kk+1) = ydat(:,k); | |
810 zz(:,kk+2) = zdat(:,k); | |
811 zz(:,kk+3) = cdat(:,k); | |
812 k++; | |
813 endfor | |
7170 | 814 data{data_idx} = zz.'; |
7109 | 815 endif |
816 | |
8166
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
817 if (doing_interp_color) |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
818 interp_str = "interpolate 4, 4"; |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
819 else |
8171
15ffb9836c01
__go_draw_axes__.m: Remove depdenence on gnuplot version.
Ben Abbott <bpabbott@mac.com>
parents:
8166
diff
changeset
|
820 ## No interpolation of facecolors. |
8166
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
821 interp_str = ""; |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
822 endif |
8171
15ffb9836c01
__go_draw_axes__.m: Remove depdenence on gnuplot version.
Ben Abbott <bpabbott@mac.com>
parents:
8166
diff
changeset
|
823 usingclause{data_idx} = "using ($1):($2):($3):($4)"; |
8166
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
824 |
7119 | 825 flat_interp_face = (strncmp (obj.facecolor, "flat", 4) |
826 || strncmp (obj.facecolor, "interp", 6)); | |
827 flat_interp_edge = (strncmp (obj.edgecolor, "flat", 4) | |
828 || strncmp (obj.edgecolor, "interp", 6)); | |
7154 | 829 |
830 facecolor_none_or_white = (strncmp (obj.facecolor, "none", 4) | |
831 || (isnumeric (obj.facecolor) | |
832 && all (obj.facecolor == 1))); | |
7582 | 833 hidden_removal = false; |
7592 | 834 fputs (plot_stream, "set style increment default;\n"); |
7318 | 835 if (flat_interp_edge && facecolor_none_or_white) |
7189 | 836 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
|
837 fputs (plot_stream, "unset pm3d\n"); |
7582 | 838 if (all (obj.facecolor == 1)) |
7592 | 839 hidden_removal = true; |
7582 | 840 endif |
7541
6acd0a18a3ee
If FaceColor is none don't use pm3d mode and set linestyle correctly.
kai@linux-pc
parents:
7540
diff
changeset
|
841 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
|
842 edgecol = obj.edgecolor; |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
843 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
844 colorspec = ""; |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
845 else |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
846 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
|
847 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
|
848 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
849 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
|
850 hidden_removal = true; |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
851 endif |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
852 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
|
853 fprintf (plot_stream, |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
854 "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
|
855 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
|
856 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
|
857 withclause{data_idx} = sprintf("with line linestyle %d", data_idx); |
7582 | 858 fputs (plot_stream, "unset pm3d\n"); |
7119 | 859 endif |
7109 | 860 |
8166
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
861 if (doing_interp_color) |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
862 ## "depthorder" interferes with interpolation of colors. |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
863 dord = "scansautomatic"; |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
864 else |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
865 dord = "depthorder"; |
4024fc815f8d
__go_draw_axes__.m: Fix interpolation of facecolors.
Ben Abbott <bpabbott@mac.com>
parents:
8164
diff
changeset
|
866 endif |
7109 | 867 |
7318 | 868 if (flat_interp_face && strncmp (obj.edgecolor, "flat", 4)) |
869 fprintf (plot_stream, "set pm3d explicit at s %s %s corners2color c3;\n", | |
7189 | 870 interp_str, dord); |
7318 | 871 elseif (!facecolor_none_or_white) |
7119 | 872 if (strncmp (obj.edgecolor, "none", 4)) |
7318 | 873 fprintf (plot_stream, "set pm3d explicit at s %s corners2color c3;\n", |
7189 | 874 interp_str, dord); |
7109 | 875 else |
7119 | 876 edgecol = obj.edgecolor; |
877 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
|
878 edgecol = [0, 0, 0]; |
7119 | 879 endif |
7318 | 880 fprintf (plot_stream, "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n", |
7189 | 881 data_idx, interp_str, dord); |
7119 | 882 |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
883 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
884 colorspec = ""; |
7119 | 885 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
886 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
|
887 round (255*edgecol)); |
7119 | 888 endif |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
889 fprintf (plot_stream, |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
890 "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
|
891 data_idx, colorspec, obj.linewidth); |
7109 | 892 endif |
7119 | 893 endif |
6405 | 894 endif |
895 | |
896 case "text" | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
897 [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string"); |
7257 | 898 if (strcmp (f, "*")) |
899 fontspec = ""; | |
900 else | |
901 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
902 endif | |
6405 | 903 lpos = obj.position; |
904 halign = obj.horizontalalignment; | |
6724 | 905 angle = obj.rotation; |
6752 | 906 units = obj.units; |
6829 | 907 color = obj.color; |
6758 | 908 if (strcmpi (units, "normalized")) |
6752 | 909 units = "graph"; |
910 else | |
911 units = ""; | |
912 endif | |
913 | |
6829 | 914 if (isnumeric (color)) |
7269 | 915 colorspec = get_text_colorspec (color, mono); |
6829 | 916 endif |
917 | |
6405 | 918 if (nd == 3) |
6724 | 919 fprintf (plot_stream, |
7390 | 920 "set label \"%s\" at %s %.15g,%.15g,%.15g %s rotate by %f %s %s front %s;\n", |
7162 | 921 undo_string_escapes (label), units, lpos(1), |
7390 | 922 lpos(2), lpos(3), halign, angle, fontspec, |
923 __do_enhanced_option__ (enhanced, obj), colorspec); | |
6405 | 924 else |
7162 | 925 fprintf (plot_stream, |
7390 | 926 "set label \"%s\" at %s %.15g,%.15g %s rotate by %f %s %s front %s;\n", |
7162 | 927 undo_string_escapes (label), units, |
7390 | 928 lpos(1), lpos(2), halign, angle, fontspec, |
929 __do_enhanced_option__ (enhanced, obj), colorspec); | |
6405 | 930 endif |
931 | |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
932 case "hggroup" |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
933 # push group children into the kid list |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
934 kids = [obj.children kids]; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
935 |
6405 | 936 otherwise |
937 error ("__go_draw_axes__: unknown object class, %s", | |
938 obj.type); | |
939 endswitch | |
940 | |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
941 endwhile |
6405 | 942 |
7692
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
943 ## 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
|
944 ## 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
|
945 if (nd == 2 || (data_idx > 1 && !view_map)) |
7692
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
946 fputs (plot_stream, "set pm3d implicit;\n"); |
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
947 else |
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
948 fputs (plot_stream, "set pm3d explicit;\n"); |
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
949 endif |
da1f4bc7cbe8
Conditionally set 'set pm3d implicit'
David Bateman <dbateman@free.fr>
parents:
7676
diff
changeset
|
950 |
7175 | 951 if (isnan(hidden_removal) || hidden_removal) |
7149 | 952 fputs (plot_stream, "set hidden3d;\n"); |
953 else | |
954 fputs (plot_stream, "unset hidden3d;\n"); | |
955 endif | |
956 | |
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
|
957 have_data = (! (isempty (data) || all (cellfun (@isempty, data)))); |
6405 | 958 |
8208 | 959 ## Note we don't use the [xy]2range of gnuplot as we don't use the |
960 ## dual axis plotting features of gnuplot | |
7222 | 961 if (isempty (xlim)) |
962 return; | |
6405 | 963 endif |
6758 | 964 if (strcmpi (axis_obj.xdir, "reverse")) |
6405 | 965 xdir = "reverse"; |
966 else | |
967 xdir = "noreverse"; | |
968 endif | |
8208 | 969 fprintf (plot_stream, "set xrange [%.15e:%.15e] %s;\n", xlim, xdir); |
6405 | 970 |
7222 | 971 if (isempty (ylim)) |
972 return; | |
6405 | 973 endif |
6758 | 974 if (strcmpi (axis_obj.ydir, "reverse")) |
6405 | 975 ydir = "reverse"; |
976 else | |
977 ydir = "noreverse"; | |
978 endif | |
8208 | 979 fprintf (plot_stream, "set yrange [%.15e:%.15e] %s;\n", ylim, ydir); |
6405 | 980 |
7119 | 981 if (nd == 3) |
7222 | 982 if (isempty (zlim)) |
983 return; | |
6405 | 984 endif |
6758 | 985 if (strcmpi (axis_obj.zdir, "reverse")) |
6405 | 986 zdir = "reverse"; |
987 else | |
988 zdir = "noreverse"; | |
989 endif | |
8171
15ffb9836c01
__go_draw_axes__.m: Remove depdenence on gnuplot version.
Ben Abbott <bpabbott@mac.com>
parents:
8166
diff
changeset
|
990 fprintf (plot_stream, "set zrange [%.15e:%.15e] %s;\n", zlim, zdir); |
6405 | 991 endif |
7110 | 992 |
7471
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
993 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
|
994 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
|
995 |
7189 | 996 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
|
997 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
|
998 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
|
999 else |
7471
86ba621332ff
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7462
diff
changeset
|
1000 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
|
1001 endif |
7189 | 1002 endif |
1003 | |
6758 | 1004 if (strcmpi (axis_obj.box, "on")) |
7119 | 1005 if (nd == 3) |
6405 | 1006 fputs (plot_stream, "set border 4095;\n"); |
1007 else | |
1008 fputs (plot_stream, "set border 431;\n"); | |
1009 endif | |
1010 else | |
7119 | 1011 if (nd == 3) |
6405 | 1012 fputs (plot_stream, "set border 895;\n"); |
1013 else | |
7320 | 1014 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
|
1015 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
|
1016 axis_obj.tickdir); |
7320 | 1017 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
|
1018 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
|
1019 axis_obj.tickdir); |
7320 | 1020 fputs (plot_stream, "set border 12;\n"); |
1021 else | |
7873
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1022 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
|
1023 axis_obj.tickdir); |
7320 | 1024 fputs (plot_stream, "set border 9;\n"); |
1025 endif | |
1026 else | |
7873
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1027 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
|
1028 axis_obj.tickdir); |
7320 | 1029 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
|
1030 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
|
1031 axis_obj.tickdir); |
7320 | 1032 fputs (plot_stream, "set border 6;\n"); |
1033 else | |
7873
02b590f46a29
correct fputs to fprintf in __go_draw_axes__.m
Jaroslav Hajek <highegg@gmail.com>
parents:
7865
diff
changeset
|
1034 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
|
1035 axis_obj.tickdir); |
7320 | 1036 fputs (plot_stream, "set border 3;\n"); |
1037 endif | |
1038 endif | |
6405 | 1039 endif |
1040 endif | |
1041 | |
7060 | 1042 if (strcmpi (axis_obj.visible, "off")) |
1043 fputs (plot_stream, "unset border; unset tics\n"); | |
7565
1e6443ff960f
handle axes linewidth property
John W. Eaton <jwe@octave.org>
parents:
7564
diff
changeset
|
1044 else |
1e6443ff960f
handle axes linewidth property
John W. Eaton <jwe@octave.org>
parents:
7564
diff
changeset
|
1045 fprintf (plot_stream, "set border lw %f;\n", axis_obj.linewidth); |
7060 | 1046 endif |
1047 | |
6758 | 1048 if (strcmpi (axis_obj.key, "on")) |
1049 if (strcmpi (axis_obj.keybox, "on")) | |
6405 | 1050 box = "box"; |
1051 else | |
1052 box = "nobox"; | |
1053 endif | |
1054 inout = "inside"; | |
6977 | 1055 keypos = axis_obj.keypos; |
1056 if (ischar (keypos)) | |
1057 keypos = lower (keypos); | |
1058 keyout = findstr (keypos, "outside"); | |
1059 if (! isempty (keyout)) | |
1060 inout = "outside"; | |
7119 | 1061 keypos = keypos(1:keyout-1); |
6977 | 1062 endif |
1063 endif | |
1064 switch (keypos) | |
6405 | 1065 case -1 |
6977 | 1066 pos = "right top"; |
6405 | 1067 inout = "outside"; |
1068 case 1 | |
1069 pos = "right top"; | |
1070 case 2 | |
1071 pos = "left top"; | |
1072 case 3 | |
1073 pos = "left bottom"; | |
6977 | 1074 case {4, 0} |
6405 | 1075 pos = "right bottom"; |
6977 | 1076 case "north" |
1077 pos = "center top"; | |
1078 case "south" | |
1079 pos = "center bottom"; | |
1080 case "east" | |
1081 pos = "right center"; | |
1082 case "west" | |
1083 pos = "left center"; | |
1084 case "northeast" | |
1085 pos = "right top"; | |
1086 case "northwest" | |
1087 pos = "left top"; | |
1088 case "southeast" | |
1089 pos = "right bottom"; | |
1090 case "southwest" | |
1091 pos = "left bottom"; | |
1092 case "best" | |
1093 pos = ""; | |
1094 warning ("legend: 'Best' not yet implemented for location specifier.\n"); | |
1095 ## least conflict with data in plot | |
1096 ## least unused space outside plot | |
6405 | 1097 otherwise |
1098 pos = ""; | |
1099 endswitch | |
1100 fprintf (plot_stream, "set key %s %s %s;\n", inout, pos, box); | |
1101 else | |
1102 fputs (plot_stream, "unset key;\n"); | |
1103 endif | |
1104 | |
1105 fputs (plot_stream, "set style data lines;\n"); | |
1106 | |
1107 if (! use_gnuplot_for_images) | |
1108 for i = 1:ximg_data_idx | |
1109 view_fcn (xlim, ylim, ximg_data{i}, view_zoom, view_cmd); | |
1110 endfor | |
1111 endif | |
1112 | |
7189 | 1113 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
|
1114 fprintf (plot_stream, |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1115 "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
|
1116 cmap_sz); |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1117 fprintf (plot_stream, |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1118 "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
|
1119 cmap_sz); |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1120 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
|
1121 fwrite (plot_stream, "\n"); |
7189 | 1122 endif |
8208 | 1123 |
1124 fputs (plot_stream, "unset colorbox;\n"); | |
7189 | 1125 |
6405 | 1126 if (have_data) |
1127 if (nd == 2) | |
1128 plot_cmd = "plot"; | |
1129 else | |
1130 plot_cmd = "splot"; | |
1131 rot_x = 90 - axis_obj.view(2); | |
1132 rot_z = axis_obj.view(1); | |
1133 while (rot_z < 0) | |
1134 rot_z += 360; | |
1135 endwhile | |
6461 | 1136 fputs (plot_stream, "set ticslevel 0;\n"); |
7271 | 1137 if (view_map && rot_x == 0 && rot_z == 0) |
1138 fputs (plot_stream, "set view map;\n"); | |
1139 else | |
1140 fprintf (plot_stream, "set view %.15g, %.15g;\n", rot_x, rot_z); | |
1141 endif | |
6405 | 1142 endif |
6611 | 1143 fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, |
6464 | 1144 usingclause{1}, titlespec{1}, withclause{1}); |
6405 | 1145 for i = 2:data_idx |
6611 | 1146 fprintf (plot_stream, ", \"-\" %s %s %s \\\n", |
6464 | 1147 usingclause{i}, titlespec{i}, withclause{i}); |
6405 | 1148 endfor |
1149 fputs (plot_stream, ";\n"); | |
1150 for i = 1:data_idx | |
6464 | 1151 if (is_image_data(i)) |
1152 fwrite (plot_stream, data{i}, "float32"); | |
1153 else | |
7119 | 1154 __gnuplot_write_data__ (plot_stream, data{i}, nd, parametric(i), |
1155 have_cdata(i)); | |
6405 | 1156 endif |
1157 endfor | |
6431 | 1158 else |
1159 fputs (plot_stream, "plot \"-\";\nInf Inf\ne\n"); | |
6405 | 1160 endif |
1161 | |
7271 | 1162 ## Needed to allow mouse rotation with pcolor |
1163 if (view_map) | |
1164 fputs (plot_stream, "unset view;\n"); | |
1165 endif | |
1166 | |
6405 | 1167 fflush (plot_stream); |
1168 | |
1169 else | |
1170 print_usage (); | |
7109 | 1171 endif |
6405 | 1172 |
1173 endfunction | |
1174 | |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1175 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
|
1176 plot_stream, errbars = "") |
6405 | 1177 |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1178 fprintf (plot_stream, "set style line %d default;\n", idx); |
6405 | 1179 fprintf (plot_stream, "set style line %d", idx); |
1180 | |
1181 found_style = false; | |
6425 | 1182 typ = NaN; |
6465 | 1183 with = ""; |
6405 | 1184 |
6425 | 1185 if (isfield (obj, "color")) |
6405 | 1186 color = obj.color; |
1187 if (isnumeric (color)) | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1188 if (! mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1189 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
|
1190 round (255*color)); |
6425 | 1191 endif |
6405 | 1192 endif |
1193 found_style = true; | |
1194 endif | |
1195 | |
1196 if (isfield (obj, "linestyle")) | |
1197 switch (obj.linestyle) | |
1198 case "-" | |
6415 | 1199 lt = "1"; |
6405 | 1200 case "--" |
6415 | 1201 lt = "2"; |
6405 | 1202 case ":" |
6415 | 1203 lt = "3"; |
6405 | 1204 case "-." |
6415 | 1205 lt = "6"; |
6405 | 1206 case "none" |
1207 lt = ""; | |
1208 otherwise | |
1209 lt = ""; | |
1210 endswitch | |
6843 | 1211 |
1212 ## FIXME -- linetype is currently broken, since it disables the | |
1213 ## gnuplot default dashed and solid linestyles with the only | |
1214 ## benefit of being able to specify '--' and get a single sized | |
1215 ## dashed line of identical dash pattern for all called this way. | |
1216 ## All dash patterns are a subset of "with lines" and none of the | |
1217 ## lt specifications will correctly propagate into the x11 terminal | |
1218 ## or the print command. Therefore, it is currently disabled in | |
1219 ## order to allow print (..., "-dashed") etc. to work correctly. | |
1220 | |
1221 ## if (! isempty (lt)) | |
1222 ## fprintf (plot_stream, " linetype %s", lt); | |
1223 ## found_style = true; | |
1224 ## endif | |
1225 | |
6405 | 1226 else |
1227 lt = ""; | |
1228 endif | |
1229 | |
1230 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
|
1231 fprintf (plot_stream, " linewidth %f", obj.linewidth); |
6405 | 1232 found_style = true; |
1233 endif | |
1234 | |
1235 if (isfield (obj, "marker")) | |
1236 switch (obj.marker) | |
1237 case "+" | |
1238 pt = "1"; | |
1239 case "o" | |
6413 | 1240 pt = "6"; |
6405 | 1241 case "*" |
1242 pt = "3"; | |
1243 case "." | |
7078 | 1244 pt = "0"; |
6405 | 1245 case "x" |
1246 pt = "2"; | |
1247 case {"square", "s"} | |
1248 pt = "5"; | |
1249 case {"diamond", "d"} | |
1250 pt = "13"; | |
1251 case "^" | |
1252 pt = "9"; | |
1253 case "v" | |
1254 pt = "11"; | |
1255 case ">" | |
1256 pt = "8"; | |
1257 case "<" | |
1258 pt = "10"; | |
1259 case {"pentagram", "p"} | |
1260 pt = "4"; | |
1261 case {"hexagram", "h"} | |
6413 | 1262 pt = "12"; |
6405 | 1263 case "none" |
1264 pt = ""; | |
1265 otherwise | |
1266 pt = ""; | |
1267 endswitch | |
1268 if (! isempty (pt)) | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1269 fprintf (plot_stream, " pointtype %s", pt); |
6405 | 1270 found_style = true; |
1271 endif | |
1272 else | |
1273 pt = ""; | |
1274 endif | |
1275 | |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1276 if (isempty (errbars)) |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1277 style = "lines"; |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1278 if (isempty (lt)) |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1279 if (! isempty (pt)) |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1280 style = "points"; |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1281 endif |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1282 elseif (! isempty (pt)) |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1283 style = "linespoints"; |
6405 | 1284 endif |
1285 | |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1286 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
|
1287 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
|
1288 found_style = true; |
6465 | 1289 endif |
7510
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1290 else |
f3e6ada67d9e
improve handling line style for errorbar plots
John W. Eaton <jwe@octave.org>
parents:
7472
diff
changeset
|
1291 style = errbars; |
6465 | 1292 found_style = true; |
1293 endif | |
1294 | |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1295 if (! found_style) |
6405 | 1296 fputs (plot_stream, " default"); |
1297 endif | |
1298 | |
1299 fputs (plot_stream, ";\n"); | |
1300 | |
1301 endfunction | |
6510 | 1302 |
7316 | 1303 function nd = __calc_dimensions__ (obj) |
1304 kids = obj.children; | |
1305 nd = 2; | |
1306 for i = 1:length (kids) | |
1307 obj = get (kids(i)); | |
1308 switch (obj.type) | |
1309 case {"image", "text"} | |
1310 ## ignore as they | |
1311 case {"line", "patch"} | |
1312 if (! isempty (obj.zdata)) | |
1313 nd = 3; | |
1314 endif | |
1315 case "surface" | |
1316 nd = 3; | |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1317 case "hggroup" |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1318 obj_nd = __calc_dimensions__ (obj); |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1319 if (obj_nd == 3) |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1320 nd = 3; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7726
diff
changeset
|
1321 endif |
7316 | 1322 endswitch |
1323 endfor | |
1324 endfunction | |
1325 | |
7119 | 1326 function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata) |
6510 | 1327 |
1328 ## DATA is already transposed. | |
1329 | |
1330 ## FIXME -- this may need to be converted to C++ for speed. | |
1331 | |
6605 | 1332 ## Convert NA elements to normal NaN values because fprintf writes |
1333 ## "NA" and that confuses gnuplot. | |
1334 idx = find (isna (data)); | |
1335 if (any (idx)) | |
1336 data(idx) = NaN; | |
1337 endif | |
1338 | |
6510 | 1339 if (nd == 2) |
1340 nan_elts = find (sum (isnan (data))); | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1341 fmt = cstrcat (repmat ("%.15g ", 1, rows (data)), "\n"); |
6510 | 1342 if (isempty (nan_elts)) |
1343 fprintf (plot_stream, fmt, data); | |
1344 else | |
1345 n = columns (data); | |
1346 have_nans = true; | |
1347 num_nan_elts = numel (nan_elts); | |
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
|
1348 if (num_nan_elts == n) |
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
|
1349 fputs (plot_stream, "Inf Inf\n"); |
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
|
1350 else |
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
|
1351 k = 1; |
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
|
1352 for i = 1:n |
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
|
1353 if (have_nans && i == nan_elts(k)) |
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
|
1354 fputs (plot_stream, "\n"); |
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
|
1355 have_nans = ++k <= num_nan_elts; |
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
|
1356 else |
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
|
1357 fprintf (plot_stream, fmt, data(:,i)); |
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
|
1358 endif |
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
|
1359 endfor |
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
|
1360 endif |
6510 | 1361 endif |
7109 | 1362 elseif (nd == 3) |
6510 | 1363 ## FIXME -- handle NaNs here too? |
1364 if (parametric) | |
6914 | 1365 fprintf (plot_stream, "%.15g %.15g %.15g\n", data); |
6510 | 1366 else |
7170 | 1367 nr = rows (data); |
7119 | 1368 if (cdata) |
7170 | 1369 for j = 1:4:nr |
1370 fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data(j:j+3,:)); | |
7119 | 1371 fputs (plot_stream, "\n"); |
1372 endfor | |
1373 else | |
7170 | 1374 for j = 1:3:nr |
1375 fprintf (plot_stream, "%.15g %.15g %.15g\n", data(j:j+2,:)); | |
7119 | 1376 fputs (plot_stream, "\n"); |
1377 endfor | |
1378 endif | |
7109 | 1379 endif |
6510 | 1380 endif |
1381 fputs (plot_stream, "e\n"); | |
1382 | |
1383 endfunction | |
6745 | 1384 |
7269 | 1385 function do_tics (obj, plot_stream, ymirror, mono) |
6809 | 1386 if (strcmpi (obj.xaxislocation, "top")) |
1387 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
|
1388 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
|
1389 obj.tickdir); |
6809 | 1390 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
|
1391 obj.xcolor, "x", plot_stream, true, mono, "border", ""); |
7321 | 1392 elseif (strcmpi (obj.xaxislocation, "zero")) |
1393 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
|
1394 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
|
1395 obj.tickdir); |
7321 | 1396 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
|
1397 obj.xcolor, "x2", plot_stream, true, mono, "axis", ""); |
6809 | 1398 else |
1399 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
|
1400 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
|
1401 obj.tickdir); |
6809 | 1402 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
|
1403 obj.xcolor, "x2", plot_stream, true, mono, "border", ""); |
6809 | 1404 endif |
1405 if (strcmpi (obj.yaxislocation, "right")) | |
1406 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
|
1407 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
|
1408 obj.tickdir); |
6809 | 1409 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
|
1410 obj.ycolor, "y", plot_stream, ymirror, mono, "border", ""); |
7321 | 1411 elseif (strcmpi (obj.xaxislocation, "zero")) |
1412 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
|
1413 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
|
1414 obj.tickdir); |
7321 | 1415 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
|
1416 obj.ycolor, "y2", plot_stream, ymirror, mono, "axis", ""); |
6809 | 1417 else |
1418 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
|
1419 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
|
1420 obj.tickdir); |
6809 | 1421 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
|
1422 obj.ycolor, "y2", plot_stream, ymirror, mono, "border", ""); |
6809 | 1423 endif |
6745 | 1424 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
|
1425 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
|
1426 obj.tickdir); |
6745 | 1427 endfunction |
1428 | |
7269 | 1429 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
|
1430 plot_stream, mirror, mono, axispos, tickdir) |
7269 | 1431 colorspec = get_text_colorspec (color, mono); |
8112
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1432 if (strcmpi (ticmode, "manual") || strcmpi (labelmode, "manual")) |
6745 | 1433 if (isempty (tics)) |
1434 fprintf (plot_stream, "unset %stics;\n", ax); | |
6758 | 1435 elseif (strcmpi (labelmode, "manual") && ! isempty (labels)) |
6751 | 1436 if (ischar (labels)) |
1437 labels = cellstr (labels); | |
1438 endif | |
6745 | 1439 if (iscellstr (labels)) |
6751 | 1440 k = 1; |
1441 ntics = numel (tics); | |
1442 nlabels = numel (labels); | |
6745 | 1443 fprintf (plot_stream, "set format %s \"%%s\";\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, |
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1446 tickdir, 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, |
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1449 tickdir, axispos); |
7206 | 1450 endif |
7228 | 1451 labels = regexprep(labels, "%", "%%"); |
6745 | 1452 for i = 1:ntics |
8112
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1453 fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i)); |
6745 | 1454 if (i < ntics) |
1455 fputs (plot_stream, ", "); | |
1456 endif | |
1457 if (k > nlabels) | |
1458 k = 1; | |
1459 endif | |
1460 endfor | |
7220 | 1461 fprintf (plot_stream, ") %s;\n", colorspec); |
6745 | 1462 else |
1463 error ("unsupported type of ticklabel"); | |
1464 endif | |
1465 else | |
6920 | 1466 fprintf (plot_stream, "set format %s \"%%g\";\n", ax); |
7206 | 1467 if (mirror) |
8112
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1468 fprintf (plot_stream, "set %stics %s %s mirror (", ax, tickdir, |
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1469 axispos); |
7206 | 1470 else |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1471 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
|
1472 axispos); |
7206 | 1473 endif |
8112
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1474 fprintf (plot_stream, " %.15g,", tics(1:end-1)); |
31e86163b752
Add the datetick function
David Bateman <dbateman@free.fr>
parents:
8102
diff
changeset
|
1475 fprintf (plot_stream, " %.15g);\n", tics(end)); |
6745 | 1476 endif |
1477 else | |
6920 | 1478 fprintf (plot_stream, "set format %s \"%%g\";\n", ax); |
7206 | 1479 if (mirror) |
8208 | 1480 fprintf (plot_stream, "set %stics %s %s mirror %s;\n", ax, |
1481 axispos, tickdir, colorspec); | |
7206 | 1482 else |
7676
6c0f7bcf5b55
Fix spurious tics for plotyy with gnuplot backend
David Bateman <dbateman@free.fr>
parents:
7608
diff
changeset
|
1483 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
|
1484 tickdir, axispos, colorspec); |
7206 | 1485 endif |
7194 | 1486 endif |
1487 endfunction | |
1488 | |
7269 | 1489 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
|
1490 if (mono) |
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1491 colorspec = ""; |
7194 | 1492 else |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1493 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
|
1494 round (255*color)); |
6745 | 1495 endif |
1496 endfunction | |
7163 | 1497 |
7189 | 1498 function [f, s, fnt, it, bld] = get_fontname_and_size (t) |
7163 | 1499 if (isempty (t.fontname)) |
7372 | 1500 fnt = "Helvetica"; |
7163 | 1501 else |
7372 | 1502 fnt = t.fontname; |
7168 | 1503 endif |
7189 | 1504 f = fnt; |
1505 it = false; | |
1506 bld = false; | |
7372 | 1507 if (! isempty (t.fontweight) && strcmpi (t.fontweight, "bold")) |
7168 | 1508 if (! isempty(t.fontangle) |
7372 | 1509 && (strcmpi (t.fontangle, "italic") |
1510 || 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
|
1511 f = cstrcat (f, "-bolditalic"); |
7189 | 1512 it = true; |
1513 bld = true; | |
7168 | 1514 else |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1515 f = cstrcat (f, "-bold"); |
7189 | 1516 bld = true; |
7168 | 1517 endif |
1518 elseif (! isempty(t.fontangle) | |
7372 | 1519 && (strcmpi (t.fontangle, "italic") |
1520 || 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
|
1521 f = cstrcat (f, "-italic"); |
7189 | 1522 it = true; |
7163 | 1523 endif |
1524 if (isempty (t.fontsize)) | |
1525 s = 10; | |
1526 else | |
1527 s = t.fontsize; | |
1528 endif | |
1529 endfunction | |
7189 | 1530 |
8164
0d37c99fc06f
__go_draw_axes__.m: eliminate have_newer_gnuplot variable
John W. Eaton <jwe@octave.org>
parents:
8112
diff
changeset
|
1531 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
|
1532 |
7189 | 1533 persistent warned_latex = false; |
1534 | |
1535 if (strcmp (fld, "string")) | |
1536 [f, s, fnt, it, bld] = get_fontname_and_size (obj); | |
1537 else | |
7372 | 1538 f = "Helvetica"; |
7189 | 1539 s = 10; |
1540 fnt = f; | |
1541 it = false; | |
1542 bld = false; | |
1543 endif | |
1544 | |
1545 str = getfield (obj, fld); | |
1546 if (enhanced) | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
1547 if (strcmpi (obj.interpreter, "tex")) |
7189 | 1548 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
|
1549 elseif (strcmpi (obj.interpreter, "latex")) |
7189 | 1550 if (! warned_latex) |
1551 warning ("latex text objects not supported"); | |
1552 warned_latex = true; | |
1553 endif | |
1554 endif | |
1555 endif | |
1556 endfunction | |
1557 | |
1558 function str = __tex2enhanced__ (str, fnt, it, bld) | |
1559 persistent sym = __setup_sym_table__ (); | |
1560 persistent flds = fieldnames (sym); | |
1561 | |
1562 [s, e, m] = regexp(str,'\\([a-zA-Z]+|0)','start','end','matches'); | |
1563 | |
1564 for i = length (s) : -1 : 1 | |
1565 ## special case for "\0" and replace with "{/Symbol \306}' | |
1566 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
|
1567 str = cstrcat (str(1:s(i) - 1), '{/Symbol \306}', str(s(i) + 2:end)); |
7189 | 1568 else |
1569 f = m{i}(2:end); | |
1570 if (isfield (sym, f)) | |
1571 g = getfield(sym, f); | |
1572 ## FIXME The symbol font doesn't seem to support bold or italic | |
1573 ##if (bld) | |
1574 ## if (it) | |
1575 ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); | |
1576 ## else | |
1577 ## g = regexprep (g, '/Symbol', '/Symbol-bold'); | |
1578 ## endif | |
1579 ##elseif (it) | |
1580 ## g = regexprep (g, '/Symbol', '/Symbol-italic'); | |
1581 ##endif | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1582 str = cstrcat (str(1:s(i) - 1), g, str(e(i) + 1:end)); |
7189 | 1583 elseif (strncmp (f, "rm", 2)) |
1584 bld = false; | |
1585 it = false; | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1586 str = cstrcat (str(1:s(i) - 1), '/', fnt, ' ', str(s(i) + 3:end)); |
7189 | 1587 elseif (strncmp (f, "it", 2) || strncmp (f, "sl", 2)) |
1588 it = true; | |
1589 if (bld) | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1590 str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', |
7189 | 1591 str(s(i) + 3:end)); |
1592 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1593 str = cstrcat (str(1:s(i) - 1), '/', fnt, '-italic ', |
7189 | 1594 str(s(i) + 3:end)); |
1595 endif | |
1596 elseif (strncmp (f, "bf", 2)) | |
1597 bld = true; | |
1598 if (it) | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1599 str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', |
7189 | 1600 str(2(i) + 3:end)); |
1601 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1602 str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bold ', |
7189 | 1603 str(s(i) + 3:end)); |
1604 endif | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
1605 elseif (strcmpi (f, "color")) |
7189 | 1606 ## FIXME Ignore \color but remove trailing {} block as well |
1607 d = strfind(str(e(i) + 1:end),'}'); | |
1608 if (isempty (d)) | |
1609 warning ('syntax error in \color argument'); | |
1610 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1611 str = cstrcat (str(1:s(i) - 1), str(e(i) + d + 1:end)); |
7189 | 1612 endif |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
1613 elseif(strcmpi (f, "fontname")) |
7189 | 1614 b1 = strfind(str(e(i) + 1:end),'{'); |
1615 b2 = strfind(str(e(i) + 1:end),'}'); | |
1616 if (isempty(b1) || isempty(b2)) | |
1617 warning ('syntax error in \fontname argument'); | |
1618 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1619 str = cstrcat (str(1:s(i) - 1), '/', |
7189 | 1620 str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', |
1621 str(e(i) + b2(1) + 1:end)); | |
1622 endif | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8171
diff
changeset
|
1623 elseif(strcmpi (f, "fontsize")) |
7189 | 1624 b1 = strfind(str(e(i) + 1:end),'{'); |
1625 b2 = strfind(str(e(i) + 1:end),'}'); | |
1626 if (isempty(b1) || isempty(b2)) | |
1627 warning ('syntax error in \fontname argument'); | |
1628 else | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1629 str = cstrcat (str(1:s(i) - 1), '/=', |
7189 | 1630 str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', |
1631 str(e(i) + b2(1) + 1:end)); | |
1632 endif | |
1633 else | |
1634 ## Last desperate attempt to treat the symbol. Look for things | |
1635 ## like \pix, that should be translated to the symbol Pi and x | |
1636 for j = 1 : length (flds) | |
1637 if (strncmp (flds{j}, f, length (flds{j}))) | |
1638 g = getfield(sym, flds{j}); | |
1639 ## FIXME The symbol font doesn't seem to support bold or italic | |
1640 ##if (bld) | |
1641 ## if (it) | |
1642 ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); | |
1643 ## else | |
1644 ## g = regexprep (g, '/Symbol', '/Symbol-bold'); | |
1645 ## endif | |
1646 ##elseif (it) | |
1647 ## g = regexprep (g, '/Symbol', '/Symbol-italic'); | |
1648 ##endif | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7513
diff
changeset
|
1649 str = cstrcat (str(1:s(i) - 1), g, |
7189 | 1650 str(s(i) + length (flds{j}) + 1:end)); |
1651 break; | |
1652 endif | |
1653 endfor | |
1654 endif | |
1655 endif | |
1656 endfor | |
1657 | |
1658 ## Prepend @ to things things like _0^x or _{-100}^{100} for alignment | |
1659 ## But need to put the shorter of the two arguments first. Carful of | |
1660 ## nested {} and unprinted characters when defining shortest.. Don't | |
1661 ## have to worry about things like ^\theta as they are already converted to | |
1662 ## ^{/Symbol q}. | |
1663 | |
1664 ## FIXME.. This is a mess... Is it worth it just for a "@" character? | |
1665 | |
1666 [s, m] = regexp(str,'[_\^]','start','matches'); | |
1667 i = 1; | |
1668 p = 0; | |
1669 while (i < length (s)) | |
1670 if (i < length(s)) | |
1671 if (str(s(i) + p + 1) == "{") | |
1672 s1 = strfind(str(s(i) + p + 2:end),'{'); | |
1673 si = 1; | |
1674 l1 = strfind(str(s(i) + p + 1:end),'}'); | |
1675 li = 1; | |
1676 while (li <= length (l1) && si <= length (s1)) | |
1677 if (l1(li) < s1(si)) | |
1678 if (li == si) | |
1679 break; | |
1680 endif | |
1681 li++; | |
1682 else | |
1683 si++; | |
1684 endif | |
1685 endwhile | |
1686 l1 = l1 (min (length(l1), si)); | |
1687 if (s(i) + l1 + 1 == s(i+1)) | |
1688 if (str(s(i + 1) + p + 1) == "{") | |
1689 s2 = strfind(str(s(i + 1) + p + 2:end),'{'); | |
1690 si = 1; | |
1691 l2 = strfind(str(s(i + 1) + p + 1:end),'}'); | |
1692 li = 1; | |
1693 while (li <= length (l2) && si <= length (s2)) | |
1694 if (l2(li) < s2(si)) | |
1695 if (li == si) | |
1696 break; | |
1697 endif | |
1698 li++; | |
1699 else | |
1700 si++; | |
1701 endif | |
1702 endwhile | |
1703 l2 = l2 (min (length(l2), si)); | |
1704 if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <= | |
1705 length_string(str(s(i+1)+p+2:s(i+1)+p+l2-1))) | |
1706 ## 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
|
1707 str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end)); |
7189 | 1708 else |
1709 ## 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
|
1710 str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2), |
7189 | 1711 str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end)); |
1712 endif | |
1713 else | |
1714 ## 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
|
1715 str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1), |
7189 | 1716 str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end)); |
1717 endif | |
1718 i += 2; | |
1719 p ++; | |
1720 else | |
1721 i++; | |
1722 endif | |
1723 else | |
1724 if (s(i+1) == s(i) + 2) | |
1725 ## 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
|
1726 str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end)); |
7189 | 1727 p ++; |
1728 i += 2; | |
1729 else | |
1730 i ++; | |
1731 endif | |
1732 endif | |
1733 else | |
1734 i ++; | |
1735 endif | |
1736 endwhile | |
1737 | |
1738 endfunction | |
1739 | |
1740 function l = length_string (s) | |
1741 l = length (s) - length (strfind(s,'{')) - length (strfind(s,'}')); | |
1742 m = regexp (s, '/([\w\-]+|[\w\-]+=\d+)', 'matches'); | |
1743 if (!isempty (m)) | |
1744 l = l - sum (cellfun (@length, m)); | |
1745 endif | |
1746 endfunction | |
1747 | |
1748 function sym = __setup_sym_table__ () | |
1749 ## Setup the translation table for TeX to gnuplot enhanced mode. | |
1750 sym.forall = '{/Symbol \042}'; | |
1751 sym.exists = '{/Symbol \044}'; | |
1752 sym.ni = '{/Symbol \047}'; | |
1753 sym.cong = '{/Symbol \100}'; | |
1754 sym.Delta = '{/Symbol D}'; | |
1755 sym.Phi = '{/Symbol F}'; | |
7608
49810341db91
Correct typos in __go_draw_axes__.m and update Manual
godfrey@qss.Stanford.EDU
parents:
7603
diff
changeset
|
1756 sym.Gamma = '{/Symbol G}'; |
7190 | 1757 sym.vartheta = '{/Symbol J}'; |
7189 | 1758 sym.Lambda = '{/Symbol L}'; |
1759 sym.Pi = '{/Symbol P}'; | |
1760 sym.Theta = '{/Symbol Q}'; | |
1761 sym.Sigma = '{/Symbol S}'; | |
1762 sym.varsigma = '{/Symbol V}'; | |
7420 | 1763 sym.Omega = '{/Symbol W}'; |
7189 | 1764 sym.Xi = '{/Symbol X}'; |
1765 sym.Psi = '{/Symbol Y}'; | |
1766 sym.perp = '{/Symbol \136}'; | |
1767 sym.alpha = '{/Symbol a}'; | |
1768 sym.beta = '{/Symbol b}'; | |
1769 sym.chi = '{/Symbol c}'; | |
1770 sym.delta = '{/Symbol d}'; | |
1771 sym.epsilon = '{/Symbol e}'; | |
1772 sym.phi = '{/Symbol f}'; | |
7608
49810341db91
Correct typos in __go_draw_axes__.m and update Manual
godfrey@qss.Stanford.EDU
parents:
7603
diff
changeset
|
1773 sym.gamma = '{/Symbol g}'; |
7189 | 1774 sym.eta = '{/Symbol h}'; |
1775 sym.iota = '{/Symbol i}'; | |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1776 sym.varphi = '{/Symbol j}'; |
7189 | 1777 sym.kappa = '{/Symbol k}'; |
1778 sym.lambda = '{/Symbol l}'; | |
1779 sym.mu = '{/Symbol m}'; | |
1780 sym.nu = '{/Symbol n}'; | |
1781 sym.o = '{/Symbol o}'; | |
1782 sym.pi = '{/Symbol p}'; | |
1783 sym.theta = '{/Symbol q}'; | |
1784 sym.rho = '{/Symbol r}'; | |
1785 sym.sigma = '{/Symbol s}'; | |
1786 sym.tau = '{/Symbol t}'; | |
1787 sym.upsilon = '{/Symbol u}'; | |
1788 sym.varpi = '{/Symbol v}'; | |
1789 sym.omega = '{/Symbol w}'; | |
1790 sym.xi = '{/Symbol x}'; | |
1791 sym.psi = '{/Symbol y}'; | |
1792 sym.zeta = '{/Symbol z}'; | |
1793 sym.sim = '{/Symbol \176}'; | |
1794 sym.Upsilon = '{/Symbol \241}'; | |
1795 sym.prime = '{/Symbol \242}'; | |
1796 sym.leq = '{/Symbol \243}'; | |
1797 sym.infty = '{/Symbol \245}'; | |
1798 sym.clubsuit = '{/Symbol \247}'; | |
1799 sym.diamondsuit = '{/Symbol \250}'; | |
1800 sym.heartsuit = '{/Symbol \251}'; | |
1801 sym.spadesuit = '{/Symbol \252}'; | |
1802 sym.leftrightarrow = '{/Symbol \253}'; | |
1803 sym.leftarrow = '{/Symbol \254}'; | |
1804 sym.uparrow = '{/Symbol \255}'; | |
1805 sym.rightarrow = '{/Symbol \256}'; | |
1806 sym.downarrow = '{/Symbol \257}'; | |
1807 sym.circ = '{/Symbol \260}'; | |
1808 sym.pm = '{/Symbol \261}'; | |
1809 sym.geq = '{/Symbol \263}'; | |
1810 sym.times = '{/Symbol \264}'; | |
1811 sym.propto = '{/Symbol \265}'; | |
1812 sym.partial = '{/Symbol \266}'; | |
1813 sym.bullet = '{/Symbol \267}'; | |
1814 sym.div = '{/Symbol \270}'; | |
1815 sym.neq = '{/Symbol \271}'; | |
1816 sym.equiv = '{/Symbol \272}'; | |
1817 sym.approx = '{/Symbol \273}'; | |
1818 sym.ldots = '{/Symbol \274}'; | |
1819 sym.mid = '{/Symbol \275}'; | |
1820 sym.aleph = '{/Symbol \300}'; | |
1821 sym.Im = '{/Symbol \301}'; | |
1822 sym.Re = '{/Symbol \302}'; | |
1823 sym.wp = '{/Symbol \303}'; | |
1824 sym.otimes = '{/Symbol \304}'; | |
1825 sym.oplus = '{/Symbol \305}'; | |
1826 sym.oslash = '{/Symbol \306}'; | |
1827 sym.cap = '{/Symbol \307}'; | |
1828 sym.cup = '{/Symbol \310}'; | |
1829 sym.supset = '{/Symbol \311}'; | |
1830 sym.supseteq = '{/Symbol \312}'; | |
1831 sym.subset = '{/Symbol \314}'; | |
1832 sym.subseteq = '{/Symbol \315}'; | |
1833 sym.in = '{/Symbol \316}'; | |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1834 sym.notin = '{/Symbol \317}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1835 sym.angle = '{/Symbol \320}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1836 sym.bigtriangledown = '{/Symbol \321}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1837 sym.langle = '{/Symbol \341}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1838 sym.rangle = '{/Symbol \361}'; |
7189 | 1839 sym.nabla = '{/Symbol \321}'; |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1840 sym.prod = '{/Symbol \325}'; |
7189 | 1841 sym.surd = '{/Symbol \326}'; |
1842 sym.cdot = '{/Symbol \327}'; | |
1843 sym.neg = '{/Symbol \330}'; | |
1844 sym.wedge = '{/Symbol \331}'; | |
1845 sym.vee = '{/Symbol \332}'; | |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1846 sym.Leftrightarrow = '{/Symbol \333}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1847 sym.Leftarrow = '{/Symbol \334}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1848 sym.Uparrow = '{/Symbol \335}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1849 sym.Rightarrow = '{/Symbol \336}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1850 sym.Downarrow = '{/Symbol \337}'; |
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1851 sym.diamond = '{/Symbol \340}'; |
7189 | 1852 sym.copyright = '{/Symbol \343}'; |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1853 sym.lfloor = '{/Symbol \353}'; |
7189 | 1854 sym.lceil = '{/Symbol \351}'; |
7593
fdb6ff523237
__go_draw_axes__: use correct symbol codes
Michael D. Godfrey
parents:
7592
diff
changeset
|
1855 sym.rfloor = '{/Symbol \373}'; |
7189 | 1856 sym.rceil = '{/Symbol \371}'; |
1857 sym.int = '{/Symbol \362}'; | |
1858 endfunction | |
1859 | |
7390 | 1860 function retval = __do_enhanced_option__ (enhanced, obj) |
1861 retval = ""; | |
1862 if (enhanced) | |
1863 if (strcmpi (obj.interpreter, "none")) | |
1864 retval = "noenhanced"; | |
1865 else | |
1866 retval = "enhanced"; | |
1867 endif | |
1868 endif | |
1869 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
|
1870 |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1871 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
|
1872 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
|
1873 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
|
1874 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
|
1875 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
|
1876 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
|
1877 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
|
1878 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
|
1879 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
|
1880 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
|
1881 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
|
1882 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
|
1883 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
|
1884 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
|
1885 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
|
1886 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
|
1887 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
|
1888 else |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1889 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
|
1890 endif |
b1ff001022af
__go_draw_axes__: eliminate repeated code with get_old_gnuplot_color subfunction
John W. Eaton <jwe@octave.org>
parents:
7541
diff
changeset
|
1891 endfunction |