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