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