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