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