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