Mercurial > octave
annotate doc/interpreter/splineimages.m @ 31246:43a6be589387
doc: New documentation for memoization techniques (bug #60860)
vectorize.texi: New section on memoization
octave.texi: List new section
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Thu, 29 Sep 2022 20:31:52 -0400 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3 ## Copyright (C) 2012-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27847
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
14509 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24462
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
14509 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24462
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
14509 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
14509 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
21 ## along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24462
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
14509 | 25 |
20307
c3c1fb44f9b5
eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents:
19717
diff
changeset
|
26 function splineimages (d, nm, typ) |
28620
45a9dcee45db
doc: Short-circuit building txt images for manual (bug #57591).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
27 |
45a9dcee45db
doc: Short-circuit building txt images for manual (bug #57591).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
28 if (strcmp (typ, "txt")) |
45a9dcee45db
doc: Short-circuit building txt images for manual (bug #57591).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
29 image_as_txt (d, nm); |
45a9dcee45db
doc: Short-circuit building txt images for manual (bug #57591).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
30 return; |
45a9dcee45db
doc: Short-circuit building txt images for manual (bug #57591).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
31 endif |
45a9dcee45db
doc: Short-circuit building txt images for manual (bug #57591).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
32 |
20335
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
33 set_graphics_toolkit (); |
14509 | 34 set_print_size (); |
35 hide_output (); | |
20316
d8992a16643c
doc: Clean up m-files which generate images for Manual.
Rik <rik@octave.org>
parents:
20307
diff
changeset
|
36 outfile = fullfile (d, [nm "." typ]); |
14509 | 37 if (strcmp (typ, "png")) |
24462
8ff3c13d14c1
groot.m: New function to return handle of graphics root object.
Rik <rik@octave.org>
parents:
23633
diff
changeset
|
38 set (groot, "defaulttextfontname", "*"); |
14509 | 39 endif |
40 if (strcmp (typ, "eps")) | |
41 d_typ = "-depsc2"; | |
42 else | |
16994
333243133364
Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents:
14526
diff
changeset
|
43 d_typ = ["-d" typ]; |
14509 | 44 endif |
45 | |
28620
45a9dcee45db
doc: Short-circuit building txt images for manual (bug #57591).
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
46 if (strcmp (nm, "splinefit1")) ## Breaks and Pieces |
23633
271d34c20678
splineimages.m: generate the same plots for documentation each time (bug #51254)
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
47 rand ("state", 1); |
271d34c20678
splineimages.m: generate the same plots for documentation each time (bug #51254)
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
48 randn ("state", 1); |
14509 | 49 x = 2 * pi * rand (1, 200); |
50 y = sin (x) + sin (2 * x) + 0.2 * randn (size (x)); | |
51 ## Uniform breaks | |
52 breaks = linspace (0, 2 * pi, 41); ## 41 breaks, 40 pieces | |
53 pp1 = splinefit (x, y, breaks); | |
54 ## Breaks interpolated from data | |
55 pp2 = splinefit (x, y, 10); ## 11 breaks, 10 pieces | |
56 ## Plot | |
57 xx = linspace (0, 2 * pi, 400); | |
58 y1 = ppval (pp1, xx); | |
59 y2 = ppval (pp2, xx); | |
17504
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
60 plot (x, y, ".", xx, [y1; y2]); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
61 axis tight; |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
62 ylim ([-2.5 2.5]); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
63 legend ("data", "41 breaks, 40 pieces", "11 breaks, 10 pieces"); |
20307
c3c1fb44f9b5
eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents:
19717
diff
changeset
|
64 print (outfile, d_typ); |
14509 | 65 elseif (strcmp (nm, "splinefit2")) ## Spline orders |
66 ## Data (200 points) | |
23633
271d34c20678
splineimages.m: generate the same plots for documentation each time (bug #51254)
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
67 rand ("state", 1); |
271d34c20678
splineimages.m: generate the same plots for documentation each time (bug #51254)
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
68 randn ("state", 1); |
14509 | 69 x = 2 * pi * rand (1, 200); |
70 y = sin (x) + sin (2 * x) + 0.1 * randn (size (x)); | |
71 ## Splines | |
72 pp1 = splinefit (x, y, 8, "order", 0); ## Piecewise constant | |
73 pp2 = splinefit (x, y, 8, "order", 1); ## Piecewise linear | |
74 pp3 = splinefit (x, y, 8, "order", 2); ## Piecewise quadratic | |
75 pp4 = splinefit (x, y, 8, "order", 3); ## Piecewise cubic | |
76 pp5 = splinefit (x, y, 8, "order", 4); ## Etc. | |
77 ## Plot | |
78 xx = linspace (0, 2 * pi, 400); | |
79 y1 = ppval (pp1, xx); | |
80 y2 = ppval (pp2, xx); | |
81 y3 = ppval (pp3, xx); | |
82 y4 = ppval (pp4, xx); | |
83 y5 = ppval (pp5, xx); | |
17504
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
84 plot (x, y, ".", xx, [y1; y2; y3; y4; y5]); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
85 axis tight; |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
86 ylim ([-2.5 2.5]); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
87 legend ({"data", "order 0", "order 1", "order 2", "order 3", "order 4"}); |
20307
c3c1fb44f9b5
eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents:
19717
diff
changeset
|
88 print (outfile, d_typ); |
14509 | 89 elseif (strcmp (nm, "splinefit3")) |
90 ## Data (100 points) | |
23633
271d34c20678
splineimages.m: generate the same plots for documentation each time (bug #51254)
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
91 rand ("state", 1); |
271d34c20678
splineimages.m: generate the same plots for documentation each time (bug #51254)
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
92 randn ("state", 1); |
14509 | 93 x = 2 * pi * [0, (rand (1, 98)), 1]; |
94 y = sin (x) - cos (2 * x) + 0.2 * randn (size (x)); | |
95 ## No constraints | |
96 pp1 = splinefit (x, y, 10, "order", 5); | |
97 ## Periodic boundaries | |
98 pp2 = splinefit (x, y, 10, "order", 5, "periodic", true); | |
99 ## Plot | |
100 xx = linspace (0, 2 * pi, 400); | |
101 y1 = ppval (pp1, xx); | |
102 y2 = ppval (pp2, xx); | |
17504
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
103 plot (x, y, ".", xx, [y1; y2]); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
104 axis tight; |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
105 ylim ([-2 3]); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
106 legend ({"data", "no constraints", "periodic"}); |
20307
c3c1fb44f9b5
eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents:
19717
diff
changeset
|
107 print (outfile, d_typ); |
14509 | 108 elseif (strcmp (nm, "splinefit4")) |
109 ## Data (200 points) | |
23633
271d34c20678
splineimages.m: generate the same plots for documentation each time (bug #51254)
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
110 rand ("state", 1); |
271d34c20678
splineimages.m: generate the same plots for documentation each time (bug #51254)
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
111 randn ("state", 1); |
14509 | 112 x = 2 * pi * rand (1, 200); |
113 y = sin (2 * x) + 0.1 * randn (size (x)); | |
114 ## Breaks | |
115 breaks = linspace (0, 2 * pi, 10); | |
116 ## Clamped endpoints, y = y" = 0 | |
117 xc = [0, 0, 2*pi, 2*pi]; | |
118 cc = [(eye (2)), (eye (2))]; | |
119 con = struct ("xc", xc, "cc", cc); | |
120 pp1 = splinefit (x, y, breaks, "constraints", con); | |
121 ## Hinged periodic endpoints, y = 0 | |
122 con = struct ("xc", 0); | |
123 pp2 = splinefit (x, y, breaks, "constraints", con, "periodic", true); | |
124 ## Plot | |
125 xx = linspace (0, 2 * pi, 400); | |
126 y1 = ppval (pp1, xx); | |
127 y2 = ppval (pp2, xx); | |
17504
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
128 plot (x, y, ".", xx, [y1; y2]); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
129 axis tight; |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
130 ylim ([-1.5 1.5]); |
20316
d8992a16643c
doc: Clean up m-files which generate images for Manual.
Rik <rik@octave.org>
parents:
20307
diff
changeset
|
131 legend ({"data", "clamped", "hinged periodic"}); |
20307
c3c1fb44f9b5
eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents:
19717
diff
changeset
|
132 print (outfile, d_typ); |
14509 | 133 elseif (strcmp (nm, "splinefit5")) |
134 ## Truncated data | |
135 x = [0, 1, 2, 4, 8, 16, 24, 40, 56, 72, 80] / 80; | |
136 y = [0, 28, 39, 53, 70, 86, 90, 79, 55, 22, 2] / 1000; | |
137 xy = [x; y]; | |
138 ## Curve length parameter | |
139 ds = sqrt (diff (x).^2 + diff (y).^2); | |
140 s = [0, cumsum(ds)]; | |
141 ## Constraints at s = 0: (x,y) = (0,0), (dx/ds,dy/ds) = (0,1) | |
142 con = struct ("xc", [0 0], "yc", [0 0; 0 1], "cc", eye (2)); | |
143 ## Fit a spline with 4 pieces | |
144 pp = splinefit (s, xy, 4, "constraints", con); | |
145 ## Plot | |
146 ss = linspace (0, s(end), 400); | |
147 xyfit = ppval (pp, ss); | |
17504
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
148 xyb = ppval (pp, pp.breaks); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
149 plot (x, y, ".", xyfit(1,:), xyfit(2,:), "r", xyb(1,:), xyb(2,:), "ro"); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
150 legend ({"data", "spline", "breaks"}); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
151 axis tight; |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
152 ylim ([0 0.1]); |
20307
c3c1fb44f9b5
eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents:
19717
diff
changeset
|
153 print (outfile, d_typ); |
14509 | 154 elseif (strcmp (nm, "splinefit6")) |
155 ## Data | |
23633
271d34c20678
splineimages.m: generate the same plots for documentation each time (bug #51254)
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
156 randn ("state", 1); |
14509 | 157 x = linspace (0, 2*pi, 200); |
158 y = sin (x) + sin (2 * x) + 0.05 * randn (size (x)); | |
159 ## Add outliers | |
160 x = [x, linspace(0,2*pi,60)]; | |
161 y = [y, -ones(1,60)]; | |
162 ## Fit splines with hinged conditions | |
163 con = struct ("xc", [0, 2*pi]); | |
164 pp1 = splinefit (x, y, 8, "constraints", con, "beta", 0.25); ## Robust fitting | |
165 pp2 = splinefit (x, y, 8, "constraints", con, "beta", 0.75); ## Robust fitting | |
166 pp3 = splinefit (x, y, 8, "constraints", con); ## No robust fitting | |
167 ## Plot | |
168 xx = linspace (0, 2*pi, 400); | |
169 y1 = ppval (pp1, xx); | |
170 y2 = ppval (pp2, xx); | |
171 y3 = ppval (pp3, xx); | |
17504
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
172 plot (x, y, ".", xx, [y1; y2; y3]); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
173 legend ({"data with outliers","robust, beta = 0.25", ... |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
174 "robust, beta = 0.75", "no robust fitting"}); |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
175 axis tight; |
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
176 ylim ([-2 2]); |
20307
c3c1fb44f9b5
eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents:
19717
diff
changeset
|
177 print (outfile, d_typ); |
14509 | 178 endif |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
179 hide_output (); |
14509 | 180 endfunction |
181 | |
20335
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
182 ## This function no longer sets the graphics toolkit; That is now done |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
183 ## automatically by C++ code which will ordinarily choose 'qt', but might |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
184 ## choose gnuplot on older systems. Only a complete lack of plotting is a |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
185 ## problem. |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
186 function set_graphics_toolkit () |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
187 if (isempty (available_graphics_toolkits ())) |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
188 error ("no graphics toolkit available for plotting"); |
24798
45470049a43f
Allow getframe and print to work without osmesa (bug #53186).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
189 elseif (strcmp ("qt", graphics_toolkit ()) |
25428
2b3c3c8c8360
Properly test Qt offscreen printing during manual figures generation.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25054
diff
changeset
|
190 && __have_feature__ ("QT_OFFSCREEN")) |
24798
45470049a43f
Allow getframe and print to work without osmesa (bug #53186).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
191 ## Use qt with QOffscreenSurface for plot |
27847
56d94f86a659
Don't test presence of OSMESA which will always fail (bug #57424)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
192 elseif (! strcmp ("gnuplot", graphics_toolkit ())) |
20885
e5f78891ad9e
Allow doc's images to be generated using gnuplot when osmesa isn't available.
Ben Abbott <bpabbott@mac.com>
parents:
20335
diff
changeset
|
193 if (! any (strcmp ("gnuplot", available_graphics_toolkits ()))) |
e5f78891ad9e
Allow doc's images to be generated using gnuplot when osmesa isn't available.
Ben Abbott <bpabbott@mac.com>
parents:
20335
diff
changeset
|
194 error ("no graphics toolkit available for offscreen plotting"); |
e5f78891ad9e
Allow doc's images to be generated using gnuplot when osmesa isn't available.
Ben Abbott <bpabbott@mac.com>
parents:
20335
diff
changeset
|
195 else |
e5f78891ad9e
Allow doc's images to be generated using gnuplot when osmesa isn't available.
Ben Abbott <bpabbott@mac.com>
parents:
20335
diff
changeset
|
196 graphics_toolkit ("gnuplot"); |
e5f78891ad9e
Allow doc's images to be generated using gnuplot when osmesa isn't available.
Ben Abbott <bpabbott@mac.com>
parents:
20335
diff
changeset
|
197 endif |
20335
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
198 endif |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
199 endfunction |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
200 |
14509 | 201 function set_print_size () |
25998
8d2b3e3ff182
print.m: Implement "-opengl", "-painters" and "-RGBImage" options (bug #52866)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25428
diff
changeset
|
202 image_size = [5.0, 3.5]; # in inches, 16:9 format |
14509 | 203 border = 0; # For postscript use 50/72 |
24462
8ff3c13d14c1
groot.m: New function to return handle of graphics root object.
Rik <rik@octave.org>
parents:
23633
diff
changeset
|
204 set (groot, "defaultfigurepapertype", "<custom>"); |
8ff3c13d14c1
groot.m: New function to return handle of graphics root object.
Rik <rik@octave.org>
parents:
23633
diff
changeset
|
205 set (groot, "defaultfigurepaperorientation", "landscape"); |
8ff3c13d14c1
groot.m: New function to return handle of graphics root object.
Rik <rik@octave.org>
parents:
23633
diff
changeset
|
206 set (groot, "defaultfigurepapersize", image_size + 2*border); |
8ff3c13d14c1
groot.m: New function to return handle of graphics root object.
Rik <rik@octave.org>
parents:
23633
diff
changeset
|
207 set (groot, "defaultfigurepaperposition", [border, border, image_size]); |
22037
782ecfde4859
doc: Create images for manual with legends that don't extend out of axes box.
Rik <rik@octave.org>
parents:
21580
diff
changeset
|
208 ## FIXME: Required until listener for legend exists (bug #39697) |
24462
8ff3c13d14c1
groot.m: New function to return handle of graphics root object.
Rik <rik@octave.org>
parents:
23633
diff
changeset
|
209 set (groot, "defaultfigureposition", [ 72*[border, border, image_size] ]); |
14509 | 210 endfunction |
211 | |
20335
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
212 ## Use this function before plotting commands and after every call to print |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
213 ## since print() resets output to stdout (unfortunately, gnuplot can't pop |
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
214 ## output as it can the terminal type). |
14509 | 215 function hide_output () |
20335
b439ccc9a162
doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents:
20316
diff
changeset
|
216 hf = figure (1, "visible", "off"); |
14509 | 217 endfunction |
218 | |
219 ## generate something for the texinfo @image command to process | |
20316
d8992a16643c
doc: Clean up m-files which generate images for Manual.
Rik <rik@octave.org>
parents:
20307
diff
changeset
|
220 function image_as_txt (d, nm) |
d8992a16643c
doc: Clean up m-files which generate images for Manual.
Rik <rik@octave.org>
parents:
20307
diff
changeset
|
221 fid = fopen (fullfile (d, [nm ".txt"]), "wt"); |
14509 | 222 fputs (fid, "\n"); |
223 fputs (fid, "+---------------------------------+\n"); | |
224 fputs (fid, "| Image unavailable in text mode. |\n"); | |
225 fputs (fid, "+---------------------------------+\n"); | |
226 fclose (fid); | |
227 endfunction | |
228 | |
17504
8b692d9ea54e
Use Octave coding conventions for m-files which generate images for manual.
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
229 |
14509 | 230 %!demo |
231 %! for s = 1:6 | |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
21226
diff
changeset
|
232 %! splineimages (sprintf ("splinefit##d", s), "pdf"); |
14509 | 233 %! endfor |