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