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