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