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