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