annotate doc/interpreter/plotimages.m @ 21226:a55b8ece1ecd

reorganize octave_config_info again * build-env-features.sh: Don't include ENABLE_ items in the output. * toplev.cc (find_config_info): New static function. (Foctave_config_info): Put Octave configuration info in the main struct. Put the build system features and build environment info in substructures. Allow searching of all elements by keyword. * __have_feature__.m, doc/interpreter/testfun.txi: Fix name of build features substructure element. * geometryimages.m, interpimages.m, plotimages.m, sparseimages.m, splineimages.m: Use __have_feature__ to check for OSMESA.
author John W. Eaton <jwe@octave.org>
date Mon, 08 Feb 2016 23:14:56 -0500
parents 80b69efcd960
children bac0d6f07a3e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
1 ## Copyright (C) 2007-2015 John W. Eaton and David Bateman
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
2 ##
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
3 ## This file is part of Octave.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
4 ##
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
6 ## under the terms of the GNU General Public License as published by
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
8 ## your option) any later version.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
9 ##
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
13 ## General Public License for more details.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
14 ##
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
15 ## You should have received a copy of the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
17 ## <http://www.gnu.org/licenses/>.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6888
diff changeset
18
20307
c3c1fb44f9b5 eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents: 19791
diff changeset
19 function plotimages (d, nm, typ)
20322
03c88436ad8c Correctly generate figure 15.7 of the Manual.
Rik <rik@octave.org>
parents: 20321
diff changeset
20 set_graphics_toolkit ();
9088
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
21 set_print_size ();
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
22 hide_output ();
20316
d8992a16643c doc: Clean up m-files which generate images for Manual.
Rik <rik@octave.org>
parents: 20315
diff changeset
23 outfile = fullfile (d, [nm "." typ]);
7257
e8a3e3e33490 [project @ 2007-12-05 01:18:41 by jwe]
jwe
parents: 7256
diff changeset
24 if (strcmp (typ, "png"))
e8a3e3e33490 [project @ 2007-12-05 01:18:41 by jwe]
jwe
parents: 7256
diff changeset
25 set (0, "defaulttextfontname", "*");
e8a3e3e33490 [project @ 2007-12-05 01:18:41 by jwe]
jwe
parents: 7256
diff changeset
26 endif
9914
e76d8c767584 Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents: 9912
diff changeset
27 if (strcmp (typ, "eps"))
e76d8c767584 Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents: 9912
diff changeset
28 d_typ = "-depsc2";
e76d8c767584 Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents: 9912
diff changeset
29 else
16994
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 14138
diff changeset
30 d_typ = ["-d", typ];
9914
e76d8c767584 Switch to color output for PostScript documentation images
Rik <rdrider0-list@yahoo.com>
parents: 9912
diff changeset
31 endif
9912
e9fe12c1b0c0 Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents: 9298
diff changeset
32
20316
d8992a16643c doc: Clean up m-files which generate images for Manual.
Rik <rik@octave.org>
parents: 20315
diff changeset
33 if (strcmp (typ , "txt"))
20315
b9d4ccf4291c Use FLTK for creating plots for Manual.
Michael D. Godfrey <michaeldgodfrey@gmail.com>
parents: 20307
diff changeset
34 image_as_txt (d, nm);
7256
be3280acbdb8 [project @ 2007-12-05 01:08:17 by jwe]
jwe
parents: 7189
diff changeset
35 elseif (strcmp (nm, "plot"))
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
36 x = -10:0.1:10;
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
37 plot (x, sin (x));
17166
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
38 xlabel ("x");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
39 ylabel ("sin (x)");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
40 title ("Simple 2-D Plot");
20307
c3c1fb44f9b5 eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents: 19791
diff changeset
41 print (outfile, d_typ);
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
42 elseif (strcmp (nm, "hist"))
19791
b254a2e0859c plotimages.m: Produce the same hist plot for documentation each time (bug #44263)
Rik <rik@octave.org>
parents: 19717
diff changeset
43 randn ("state", 1);
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
44 hist (randn (10000, 1), 30);
17166
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
45 xlabel ("Value");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
46 ylabel ("Count");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
47 title ("Histogram of 10,000 normally distributed random numbers");
20307
c3c1fb44f9b5 eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents: 19791
diff changeset
48 print (outfile, d_typ);
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
49 elseif (strcmp (nm, "errorbar"))
11033
d9c8916bb9dd Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents: 9914
diff changeset
50 rand ("state", 2);
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
51 x = 0:0.1:10;
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
52 y = sin (x);
21155
8b1e030d3d4f doc: Correct example errobar code and plot (bug #46972).
Rik <rik@octave.org>
parents: 19791
diff changeset
53 lerr = 0.1 .* rand (size (x));
8b1e030d3d4f doc: Correct example errobar code and plot (bug #46972).
Rik <rik@octave.org>
parents: 19791
diff changeset
54 uerr = 0.1 .* rand (size (x));
8b1e030d3d4f doc: Correct example errobar code and plot (bug #46972).
Rik <rik@octave.org>
parents: 19791
diff changeset
55 errorbar (x, y, lerr, uerr);
11033
d9c8916bb9dd Untabify a few remaining .m scripts.
Rik <octave@nomad.inbox5.com>
parents: 9914
diff changeset
56 axis ([0, 10, -1.1, 1.1]);
17166
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
57 xlabel ("x");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
58 ylabel ("sin (x)");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
59 title ("Errorbar plot of sin (x)");
20307
c3c1fb44f9b5 eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents: 19791
diff changeset
60 print (outfile, d_typ);
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
61 elseif (strcmp (nm, "polar"))
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
62 polar (0:0.1:10*pi, 0:0.1:10*pi);
17166
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
63 title ("Example polar plot from 0 to 10*pi");
20307
c3c1fb44f9b5 eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents: 19791
diff changeset
64 print (outfile, d_typ);
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
65 elseif (strcmp (nm, "mesh"))
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
66 tx = ty = linspace (-8, 8, 41)';
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
67 [xx, yy] = meshgrid (tx, ty);
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
68 r = sqrt (xx .^ 2 + yy .^ 2) + eps;
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
69 tz = sin (r) ./ r;
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
70 mesh (tx, ty, tz);
17166
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
71 xlabel ("tx");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
72 ylabel ("ty");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
73 zlabel ("tz");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
74 title ("3-D Sombrero plot");
20307
c3c1fb44f9b5 eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents: 19791
diff changeset
75 print (outfile, d_typ);
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
76 elseif (strcmp (nm, "plot3"))
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
77 t = 0:0.1:10*pi;
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
78 r = linspace (0, 1, numel (t));
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
79 z = linspace (0, 1, numel (t));
20316
d8992a16643c doc: Clean up m-files which generate images for Manual.
Rik <rik@octave.org>
parents: 20315
diff changeset
80 plot3 (r.*sin (t), r.*cos (t), z);
17166
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
81 xlabel ("r.*sin (t)");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
82 ylabel ("r.*cos (t)");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
83 zlabel ("z");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
84 title ("plot3 display of 3-D helix");
20307
c3c1fb44f9b5 eliminate recursive make invocations in doc directory tree
John W. Eaton <jwe@octave.org>
parents: 19791
diff changeset
85 print (outfile, d_typ);
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7018
diff changeset
86 elseif (strcmp (nm, "extended"))
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7018
diff changeset
87 x = 0:0.01:3;
20315
b9d4ccf4291c Use FLTK for creating plots for Manual.
Michael D. Godfrey <michaeldgodfrey@gmail.com>
parents: 20307
diff changeset
88 plot (x, erf (x));
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7018
diff changeset
89 hold on;
20315
b9d4ccf4291c Use FLTK for creating plots for Manual.
Michael D. Godfrey <michaeldgodfrey@gmail.com>
parents: 20307
diff changeset
90 plot (x, x, "r");
17166
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
91 axis ([0, 3, 0, 1]);
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
92 xlabel ("x");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
93 ylabel ("erf (x)");
0e34c475c956 plotimages.m: Add axis labels and titles to plots in Manual.
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 16994
diff changeset
94 title ("erf (x) with text annotation");
20337
8e056730f27c doc: Fix building of Manual plot 15.7 under gnuplot.
Rik <rik@octave.org>
parents: 20335
diff changeset
95 if (strcmp (typ, "pdf") && ! strcmp (graphics_toolkit, "gnuplot"))
8e056730f27c doc: Fix building of Manual plot 15.7 under gnuplot.
Rik <rik@octave.org>
parents: 20335
diff changeset
96 text (0.65, 0.6175, ['$\displaystyle\leftarrow x = {2\over\sqrt{\pi}}'...
8e056730f27c doc: Fix building of Manual plot 15.7 under gnuplot.
Rik <rik@octave.org>
parents: 20335
diff changeset
97 '\int_{0}^{x}e^{-t^2} dt = 0.6175$']);
20335
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
98 ## Be very careful about modifying this. pdflatex expects to be in
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
99 ## the same directory as the file it is operating on.
20715
5b7643257978 Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents: 20377
diff changeset
100 cd (make_absolute_filename (d));
20335
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
101 print ([nm ".pdf"], "-dpdflatexstandalone");
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
102 [status, output] = system (["pdflatex " nm]);
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
103 if (status)
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
104 error ("plotimages: Failed to run pdflatex on <extended.pdf>");
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
105 endif
20315
b9d4ccf4291c Use FLTK for creating plots for Manual.
Michael D. Godfrey <michaeldgodfrey@gmail.com>
parents: 20307
diff changeset
106 delete ([nm ".aux"], [nm "-inc.pdf"], [nm ".log"], [nm ".tex"]);
b9d4ccf4291c Use FLTK for creating plots for Manual.
Michael D. Godfrey <michaeldgodfrey@gmail.com>
parents: 20307
diff changeset
107 else
20335
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
108 text (0.65, 0.6175, ['\leftarrow x = {2/\surd\pi {\fontsize{16}' ...
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
109 '\int_{\fontsize{8}0}^{\fontsize{8}x}} e^{-t^2} dt} = 0.6175']);
20321
fc3056b9fac0 write figure to specified output directory
John W. Eaton <jwe@octave.org>
parents: 20316
diff changeset
110 print (outfile, d_typ);
20315
b9d4ccf4291c Use FLTK for creating plots for Manual.
Michael D. Godfrey <michaeldgodfrey@gmail.com>
parents: 20307
diff changeset
111 endif
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
112 else
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
113 error ("unrecognized plot requested");
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
114 endif
9088
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
115 hide_output ();
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
116 endfunction
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
117
20335
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
118 ## 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: 20322
diff changeset
119 ## 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: 20322
diff changeset
120 ## 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: 20322
diff changeset
121 ## problem.
20322
03c88436ad8c Correctly generate figure 15.7 of the Manual.
Rik <rik@octave.org>
parents: 20321
diff changeset
122 function set_graphics_toolkit ()
20335
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
123 if (isempty (available_graphics_toolkits ()))
b439ccc9a162 doc: Improve building of images for the Manual.
Rik <rik@octave.org>
parents: 20322
diff changeset
124 error ("no graphics toolkit available for plotting");
20885
e5f78891ad9e Allow doc's images to be generated using gnuplot when osmesa isn't available.
Ben Abbott <bpabbott@mac.com>
parents: 20715
diff changeset
125 elseif (! strcmp ("gnuplot", graphics_toolkit ()) ...
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21156
diff changeset
126 && ! __have_feature__ ("OSMESA"))
20885
e5f78891ad9e Allow doc's images to be generated using gnuplot when osmesa isn't available.
Ben Abbott <bpabbott@mac.com>
parents: 20715
diff changeset
127 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: 20715
diff changeset
128 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: 20715
diff changeset
129 else
e5f78891ad9e Allow doc's images to be generated using gnuplot when osmesa isn't available.
Ben Abbott <bpabbott@mac.com>
parents: 20715
diff changeset
130 graphics_toolkit ("gnuplot");
e5f78891ad9e Allow doc's images to be generated using gnuplot when osmesa isn't available.
Ben Abbott <bpabbott@mac.com>
parents: 20715
diff changeset
131 endif
20322
03c88436ad8c Correctly generate figure 15.7 of the Manual.
Rik <rik@octave.org>
parents: 20321
diff changeset
132 endif
03c88436ad8c Correctly generate figure 15.7 of the Manual.
Rik <rik@octave.org>
parents: 20321
diff changeset
133 endfunction
03c88436ad8c Correctly generate figure 15.7 of the Manual.
Rik <rik@octave.org>
parents: 20321
diff changeset
134
9088
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
135 function set_print_size ()
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
136 image_size = [5.0, 3.5]; # in inches, 16:9 format
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
137 border = 0; # For postscript use 50/72
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
138 set (0, "defaultfigurepapertype", "<custom>");
9912
e9fe12c1b0c0 Set default papersize to the desired imagesize
Rik <rdrider0-list@yahoo.com>
parents: 9298
diff changeset
139 set (0, "defaultfigurepaperorientation", "landscape");
9088
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
140 set (0, "defaultfigurepapersize", image_size + 2*border);
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
141 set (0, "defaultfigurepaperposition", [border, border, image_size]);
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
142 endfunction
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
143
20322
03c88436ad8c Correctly generate figure 15.7 of the Manual.
Rik <rik@octave.org>
parents: 20321
diff changeset
144 ## Use this function before plotting commands and after every call to print
03c88436ad8c Correctly generate figure 15.7 of the Manual.
Rik <rik@octave.org>
parents: 20321
diff changeset
145 ## since print() resets output to stdout (unfortunately, gnuplot can't pop
03c88436ad8c Correctly generate figure 15.7 of the Manual.
Rik <rik@octave.org>
parents: 20321
diff changeset
146 ## output as it can the terminal type).
9088
77e71f3da3d6 Fix documentation image printing under new development code
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
147 function hide_output ()
20322
03c88436ad8c Correctly generate figure 15.7 of the Manual.
Rik <rik@octave.org>
parents: 20321
diff changeset
148 hf = figure (1, "visible", "off");
6888
b3d286e8a243 [project @ 2007-09-12 06:40:58 by jwe]
jwe
parents:
diff changeset
149 endfunction
7256
be3280acbdb8 [project @ 2007-12-05 01:08:17 by jwe]
jwe
parents: 7189
diff changeset
150
be3280acbdb8 [project @ 2007-12-05 01:08:17 by jwe]
jwe
parents: 7189
diff changeset
151 ## generate something for the texinfo @image command to process
20315
b9d4ccf4291c Use FLTK for creating plots for Manual.
Michael D. Godfrey <michaeldgodfrey@gmail.com>
parents: 20307
diff changeset
152 function image_as_txt (d, nm)
20316
d8992a16643c doc: Clean up m-files which generate images for Manual.
Rik <rik@octave.org>
parents: 20315
diff changeset
153 fid = fopen (fullfile (d, [nm ".txt"]), "wt");
7256
be3280acbdb8 [project @ 2007-12-05 01:08:17 by jwe]
jwe
parents: 7189
diff changeset
154 fputs (fid, "\n");
be3280acbdb8 [project @ 2007-12-05 01:08:17 by jwe]
jwe
parents: 7189
diff changeset
155 fputs (fid, "+---------------------------------+\n");
be3280acbdb8 [project @ 2007-12-05 01:08:17 by jwe]
jwe
parents: 7189
diff changeset
156 fputs (fid, "| Image unavailable in text mode. |\n");
be3280acbdb8 [project @ 2007-12-05 01:08:17 by jwe]
jwe
parents: 7189
diff changeset
157 fputs (fid, "+---------------------------------+\n");
be3280acbdb8 [project @ 2007-12-05 01:08:17 by jwe]
jwe
parents: 7189
diff changeset
158 fclose (fid);
be3280acbdb8 [project @ 2007-12-05 01:08:17 by jwe]
jwe
parents: 7189
diff changeset
159 endfunction
20316
d8992a16643c doc: Clean up m-files which generate images for Manual.
Rik <rik@octave.org>
parents: 20315
diff changeset
160