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