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