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