Mercurial > hg > octave-lyh
annotate scripts/plot/private/__gnuplot_print__.m @ 17481:576cf0589c6d
Overhaul contour labeling functions.
* scripts/plot/clabel.m: Use 'h', rather than 'retval', to match variables to
documentation. Improve performance of input processing by using try/catch block
and eliminating for loops.
* scripts/plot/private/__clabel__.m: Get X and Y spacing in points from axis
rather than assuming 4"x3" plot figure. Fix incorrect determination of axis limits
if no contour handle provided. Rename loop vars i1, j1 to i,j. Performance
improvement by using bsxfun over repmat. Use find to replace while loop (slow).
Keep label rotation in the range [-90, 90] for readability.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 24 Sep 2013 13:16:50 -0700 |
parents | 6dbc866379e2 |
children |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
12793
diff
changeset
|
1 ## Copyright (C) 1999-2012 Daniel Heiserer |
5361 | 2 ## Copyright (C) 2001 Laurent Mazet |
3 ## | |
5362 | 4 ## This file is part of Octave. |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
5362 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
5361 | 15 ## |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
5361 | 19 |
20 ## -*- texinfo -*- | |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
21 ## @deftypefn {Function File} {} __gnuplot_print__ (@var{@dots{}}) |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
10711
diff
changeset
|
22 ## Undocumented internal function. |
5361 | 23 ## @end deftypefn |
24 | |
25 ## Author: Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de> | |
5362 | 26 ## Adapted-By: jwe |
5361 | 27 |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10915
diff
changeset
|
28 function opts = __gnuplot_print__ (opts) |
9157
fce7315c1eee
print.m: Fix typo, improvments to code, and allow for creation of tight bbox.
Ben Abbott <bpabbott@mac.com>
parents:
9152
diff
changeset
|
29 |
11009 | 30 dos_shell = (ispc () && ! isunix ()); |
31 | |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
32 if (isempty (opts.fontsize)) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
33 ## If no fontsize, determine the nominal axes fontsize. |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
34 defaultfontsize = get (0, "defaultaxesfontsize"); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
35 axesfontsize = get (findobj (opts.figure, "type", "axes"), "fontsize"); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
36 if (iscell (axesfontsize)) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
37 axesfontsize = round (median (cell2mat (axesfontsize))); |
7550
bffb1e2ab732
print.m: Figure handle as argument.
Ben Abbott <bpabbott@mac.com>
parents:
7543
diff
changeset
|
38 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
39 if (isempty (axesfontsize)) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
40 opts.fontsize = defaultfontsize; |
5361 | 41 else |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
42 opts.fontsize = axesfontsize; |
5361 | 43 endif |
11113
a8ac114ec9ab
Stylefixes, replace end by endif.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
11009
diff
changeset
|
44 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
45 ## The axes-label and tick-label spacing is determined by |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
46 ## the font spec given in "set terminal ..." |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
47 gp_opts = font_spec (opts); |
10423
dfc662a47b7a
print.m: Add '-append' option.
Ben Abbott <bpabbott@mac.com>
parents:
10422
diff
changeset
|
48 |
11009 | 49 pipeline = ""; |
50 | |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
51 switch (lower (opts.devopt)) |
17182
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
52 case {"eps", "eps2", "epsc", "epsc2"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
53 if (any (strcmp (opts.devopt, {"eps", "epsc"}))) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
54 gp_opts = [gp_opts " level1"]; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
55 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
56 if (opts.tight_flag || ! isempty (opts.preview)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
57 tmp_file = strcat (tmpnam (), ".eps"); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
58 eps_drawnow (opts, tmp_file, gp_opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
59 if (dos_shell) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
60 cleanup = [" & del " strrep(tmp_file, '/', '\')]; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
61 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
62 cleanup = [" ; rm " tmp_file]; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
63 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
64 pipeline = {sprintf("%s %s", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
65 opts.epstool_cmd (opts, tmp_file, opts.name), |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
66 cleanup)}; |
11009 | 67 else |
17182
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
68 eps_drawnow (opts, opts.name, gp_opts); |
11009 | 69 endif |
17182
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
70 case {"epslatex", "pslatex", "pstex", "epslatexstandalone"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
71 dot = find (opts.name == ".", 1, "last"); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
72 n = find (opts.devopt == "l", 1); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
73 suffix = opts.devopt(1:n-1); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
74 if (! isempty (dot)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
75 if (any (strcmpi (opts.name(dot:end), {["." suffix], ".tex", "."}))) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
76 name = opts.name(1:dot-1); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
77 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
78 error ("print:invalid-suffix", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
79 "invalid suffix '%s' for device '%s'.", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
80 opts.name(dot:end), lower (opts.devopt)); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
81 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
82 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
83 if (strfind (opts.devopt, "standalone")) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
84 term = sprintf ("%s ", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
85 strrep (opts.devopt, "standalone", " standalone")); |
14170
2ff75e38c299
improve error message in __gnuplot_print__
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
86 else |
17182
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
87 term = sprintf ("%s ", opts.devopt); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
88 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
89 if (__gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix")) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
90 suffix = "tex"; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
91 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
92 ## Gnuplot 4.0 wants a ".eps" suffix. |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
93 suffix = "eps"; |
14170
2ff75e38c299
improve error message in __gnuplot_print__
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
94 endif |
17182
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
95 local_drawnow ([term " " gp_opts], |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
96 strcat (name, ".", suffix), opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
97 case "tikz" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
98 if (__gnuplot_has_terminal__ ("tikz")) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
99 local_drawnow (["lua tikz " gp_opts], opts.name, opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
100 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
101 error (sprintf ("print:no%soutput", opts.devopt), |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
102 "print.m: '%s' output is not available for gnuplot-%s", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
103 upper (opts.devopt), __gnuplot_version__ ()); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
104 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
105 case "svg" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
106 local_drawnow (["svg dynamic " gp_opts], opts.name, opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
107 case {"aifm", "corel", "eepic", "emf", "fig"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
108 local_drawnow ([opts.devopt " " gp_opts], opts.name, opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
109 case {"pdfcairo", "pngcairo"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
110 if (__gnuplot_has_terminal__ (opts.devopt)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
111 local_drawnow ([opts.devopt " " gp_opts], opts.name, opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
112 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
113 error (sprintf ("print:no%soutput", opts.devopt), |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
114 "print.m: '%s' output is not available for gnuplot-%s", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
115 upper (opts.devopt), __gnuplot_version__ ()); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
116 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
117 case {"canvas", "dxf", "hpgl", "mf", "gif", "pstricks", "texdraw"} |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
118 local_drawnow ([opts.devopt " " gp_opts], opts.name, opts); |
17182
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
119 case opts.ghostscript.device |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
120 gp_opts = font_spec (opts, "devopt", "eps"); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
121 opts.ghostscript.output = opts.name; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
122 opts.ghostscript.source = strcat (tmpnam (), ".eps"); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
123 eps_drawnow (opts, opts.ghostscript.source, gp_opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
124 [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
125 if (opts.send_to_printer || isempty (opts.name)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
126 cmd_lpr = opts.lpr_cmd (opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
127 cmd = [cmd_gs " | " cmd_lpr]; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
128 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
129 cmd = cmd_gs; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
130 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
131 if (dos_shell) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
132 cmd = sprintf ("%s & del %s", cmd, |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
133 strrep (opts.ghostscript.source, '/', '\')); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
134 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
135 cmd = sprintf ("%s ; rm %s", cmd, opts.ghostscript.source); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
136 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
137 if (! isempty (cmd_cleanup)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
138 if (dos_shell) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
139 pipeline = {[cmd " & " cmd_cleanup]}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
140 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
141 pipeline = {[cmd " ; " cmd_cleanup]}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
142 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
143 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
144 pipeline = {cmd}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
145 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
146 otherwise |
11009 | 147 error (sprintf ("print:no%soutput", opts.devopt), |
17182
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
148 "print.m: %s output is not available for the Gnuplot graphics toolkit", |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
149 upper (opts.devopt)); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10915
diff
changeset
|
150 endswitch |
5363 | 151 |
11009 | 152 |
153 opts.pipeline = pipeline; | |
154 | |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14174
diff
changeset
|
155 for n = 1:numel (pipeline) |
11009 | 156 if (opts.debug) |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
157 fprintf ("gnuplot-pipeline: '%s'\n", pipeline{n}); |
11009 | 158 endif |
159 [status, output] = system (pipeline{n}); | |
160 if (status) | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11576
diff
changeset
|
161 fprintf ("%s\n%s\n%s\n", |
11009 | 162 "---------- output begin ----------", |
163 output, | |
164 "----------- output end -----------"); | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
165 error ("gnuplot:failedpipe", "print: failed to print"); |
11009 | 166 endif |
167 endfor | |
168 | |
5361 | 169 endfunction |
9152
4c9aff0c9a61
print.m: Use Ghostscript rather than ImageMagick's 'convert'.
Ben Abbott <bpabbott@mac.com>
parents:
9107
diff
changeset
|
170 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
171 function eps_drawnow (opts, epsfile, gp_opts) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
172 [h, fontsize] = get_figure_text_objs (opts); |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
173 unwind_protect |
17394
6dbc866379e2
Replace cellfun() occurrences with faster code where possible.
Rik <rik@octave.org>
parents:
17346
diff
changeset
|
174 fontsize_2x = cellfun (@times, {2}, fontsize, "uniformoutput", false); |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
175 set (h, {"fontsize"}, fontsize_2x); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
176 local_drawnow (["postscript eps " gp_opts], epsfile, opts); |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
177 unwind_protect_cleanup |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
178 set (h, {"fontsize"}, fontsize); |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
179 end_unwind_protect |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
180 endfunction |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
181 |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
182 function local_drawnow (term, file, opts) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
183 if (opts.use_color < 0) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
184 mono = true; |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
185 else |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
186 mono = false; |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
187 endif |
17152
bbda4d952eb5
Fix pop-up of invisible figures during printing.
Rik <rik@octave.org>
parents:
16801
diff
changeset
|
188 set (0, "currentfigure", opts.figure); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
189 if (isempty (opts.debug_file) || ! opts.debug) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
190 drawnow (term, file, mono); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
191 else |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
192 drawnow (term, file, mono, opts.debug_file); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
193 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
194 endfunction |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
195 |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
196 function f = font_spec (opts, varargin) |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14174
diff
changeset
|
197 for n = 1:2:numel (varargin) |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
198 opts.(varargin{n}) = varargin{n+1}; |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
199 endfor |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
200 f = ""; |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
201 switch (opts.devopt) |
17182
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
202 case "cgm" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
203 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
204 f = sprintf ('font "%s,%d"', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
205 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
206 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
207 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
208 f = sprintf ("%d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
209 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
210 case {"eps", "eps2", "epsc", "epsc2"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
211 ## Gnuplot renders fonts as half their specification, which |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
212 ## results in a tight spacing for the axes-labels and tick-labels. |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
213 ## Compensate for the half scale. This will produce the proper |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
214 ## spacing for the requested fontsize. |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
215 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
216 f = sprintf ('font "%s,%d"', opts.font, 2 * opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
217 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
218 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
219 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
220 f = sprintf ("%d", 2 * opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
221 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
222 case "svg" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
223 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
224 fontsize = round (opts.fontsize * 0.75); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
225 f = sprintf ('fname "%s" fsize %d', opts.font, fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
226 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
227 f = sprintf ('fname "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
228 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
229 fontsize = round (opts.fontsize * 0.75); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
230 f = sprintf ("%s fsize %d", f, fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
231 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
232 case "pdf" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
233 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
234 f = sprintf ('font "%s,%d"', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
235 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
236 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
237 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
238 f = sprintf ("fsize %d", f, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
239 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
240 case {"pdfcairo", "pngcairo"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
241 if (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
242 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
243 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
244 case {"epslatex", "epslatexstandalone"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
245 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
246 f = sprintf ('font "%s,%d"', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
247 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
248 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
249 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
250 f = sprintf ("%d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
251 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
252 case "pslatex" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
253 if (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
254 f = sprintf ("%d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
255 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
256 case {"gif", "jpeg", "png"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
257 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
258 f = sprintf ('font "%s ,%d"', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
259 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
260 f = sprintf ('font "%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
261 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
262 f = sprintf ('font "%d"', opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
263 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
264 case "emf" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
265 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
266 f = sprintf ('"%s" %d', opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
267 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
268 f = sprintf ('"%s"', opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
269 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
270 f = sprintf ("%d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
271 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
272 case "canvas" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
273 if (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
274 f = sprintf ("fsize %d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
275 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
276 case {"aifm", "corel"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
277 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
278 f = sprintf ("%s %d", opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
279 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
280 f = sprintf ("%s", opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
281 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
282 f = sprintf ("%d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
283 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
284 case "fig" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
285 if (! isempty (opts.font) && ! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
286 f = sprintf ("font %s fontsize %d", opts.font, opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
287 elseif (! isempty (opts.font)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
288 f = sprintf ("font %s", opts.font); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
289 elseif (! isempty (opts.fontsize)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
290 f = sprintf ("fontsize %d", opts.fontsize); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
291 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
292 endswitch |
9334
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
293 endfunction |
4f96a7770492
print.m: properly render mono figures, and favor cairo terminals.
Ben Abbott <bpabbott@mac.com>
parents:
9249
diff
changeset
|
294 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
295 function [h, fontsize] = get_figure_text_objs (opts) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
296 h = findall (opts.figure, "-property", "fontsize"); |
16801
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
297 hp = get (h, "parent"); |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
298 if (iscell (hp)) |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
299 hp = cell2mat (hp); |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
300 endif |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
301 ## Do not change the text objects fontsizes for the children of a |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
302 ## legend axes. These will be handled by the fontsize listener. |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
303 is_legend_key_string = strcmp (get (hp, "tag"), "legend") ... |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
304 & isprop (hp, "string") ... |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
305 & isprop (hp, "location") ... |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
306 & strcmp (get (hp, "type"), "axes"); |
d3beeaf1d363
Avoid changing the fontsize of a legend's text strings when printing.
Ben Abbott <bpabbott@mac.com>
parents:
16108
diff
changeset
|
307 h(is_legend_key_string) = []; |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
308 fontsize = get (h, "fontsize"); |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11113
diff
changeset
|
309 switch (numel (fontsize)) |
17182
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
310 case 0 |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
311 fontsize = {}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
312 case 1 |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17152
diff
changeset
|
313 fontsize = {fontsize}; |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
314 endswitch |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10854
diff
changeset
|
315 endfunction |
17346
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17182
diff
changeset
|
316 |