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