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