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