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