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