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