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