Mercurial > octave
annotate scripts/testfun/private/compare_plot_demos.m @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | 7854d5752dd2 |
children | a3d8915b9f87 |
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:
29359
diff
changeset
|
3 ## Copyright (C) 2016-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
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/>. |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
7 ## |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
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:
23220
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. |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
14 ## |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
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. |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
19 ## |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
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:
23220
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 ######################################################################## |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
25 |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
27 ## @deftypefn {} {} compare_plot_demos () |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
28 ## @deftypefnx {} {} compare_plot_demos ("toolkits", @{@var{toolkit1}, @var{toolkit2}, @dots{}@}) |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
29 ## |
18895 | 30 ## Uses @code{dump_demos} and @code{html_compare_plot_demos} to produce an |
18925
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18897
diff
changeset
|
31 ## html comparison of the plot demos for each of Octave's graphics toolkits. |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
32 ## |
18895 | 33 ## An m-file named @file{dump_plots.m} will be created in the current working |
19152
0f9c5a15c8fa
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
18925
diff
changeset
|
34 ## directory. This function will be used to render and save the plot demo |
18895 | 35 ## images. |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
36 ## |
18895 | 37 ## If they do not already exist, directories for each available graphics |
38 ## toolkit are created. Each toolkit's directory will be populated with images | |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
39 ## of each plot demo in the png format. |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
40 ## |
18895 | 41 ## Finally, an html document named @file{compare_plot_demos.html} is produced. |
42 ## This page places each toolkit's images side by side for a convenient | |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
43 ## comparison of the results. |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
44 ## |
18895 | 45 ## If the property @qcode{"toolkits"} is given then compare only the listed |
46 ## toolkits in the cell string. The list may also include the toolkit | |
47 ## @qcode{"matlab"}. | |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
48 ## |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
49 ## @end deftypefn |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
50 |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
51 function compare_plot_demos (varargin) |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
52 |
18895 | 53 arg.toolkits = available_graphics_toolkits (); |
22219
6f1887b237d5
compare_plot_demos.m: Fix default path on Windows (Bug #48717)
Andreas Weber <andy.weber.aw@gmail.com>
parents:
21758
diff
changeset
|
54 arg.directories = fullfile ("plot", {"appearance", "draw", "util"}); |
6f1887b237d5
compare_plot_demos.m: Fix default path on Windows (Bug #48717)
Andreas Weber <andy.weber.aw@gmail.com>
parents:
21758
diff
changeset
|
55 arg.directories(end + 1) = "image"; |
18895 | 56 arg.fmt = "png"; |
18925
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18897
diff
changeset
|
57 arg.fcn_file = "dump_plot_demos.m"; |
18895 | 58 arg.replace_images = false; |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
59 |
28912
0de38a6ef693
maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
60 for n = 1:2:numel (varargin) |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
61 if (! ischar (varargin{n})) |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
62 print_usage (); |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
63 else |
18895 | 64 arg.(varargin{n}) = varargin{n+1}; |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
65 endif |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
66 endfor |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
67 |
18895 | 68 if (ischar (arg.toolkits)) |
69 arg.toolkits = {arg.toolkits}; | |
70 elseif (! iscellstr (arg.toolkits)) | |
28928
ae7ce8358953
maint: Add semicolon to end of all warning() and error() invocations.
Rik <rik@octave.org>
parents:
28912
diff
changeset
|
71 error ('compare_plot_demos: Invalid value for "toolkits"'); |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
72 endif |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
73 |
18895 | 74 if (ischar (arg.directories)) |
75 arg.directories = {arg.directories}; | |
76 elseif (! iscellstr (arg.directories)) | |
28928
ae7ce8358953
maint: Add semicolon to end of all warning() and error() invocations.
Rik <rik@octave.org>
parents:
28912
diff
changeset
|
77 error ('compare_plot_demos: Invalid value for "directory"'); |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
78 endif |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
79 |
18895 | 80 if (! ischar (arg.fmt)) |
28928
ae7ce8358953
maint: Add semicolon to end of all warning() and error() invocations.
Rik <rik@octave.org>
parents:
28912
diff
changeset
|
81 error ('compare_plot_demos: Invalid value for "fmt"'); |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
82 endif |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
83 |
18925
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18897
diff
changeset
|
84 ## Generate arg.fcn_file for rendering/saving the plot demo images |
18895 | 85 dump_demos (arg.directories, arg.fcn_file, arg.fmt); |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
86 |
18895 | 87 [~, fcn_name] = fileparts (arg.fcn_file); |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
88 |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
89 ## Generate the plot demo images for each toolkit |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
90 cwd = pwd (); |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
91 unwind_protect |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
92 addpath (pwd); |
18895 | 93 for n = 1:numel (arg.toolkits) |
25781
e04c56bbbace
isdir.m: Make m-file a legacy function (bug #54489)
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
94 if (! isfolder (fullfile (cwd, arg.toolkits{n}))) |
18895 | 95 mkdir (arg.toolkits{n}); |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
96 endif |
18895 | 97 cd (arg.toolkits{n}); |
98 if (arg.replace_images && ! isempty (dir (["*." arg.fmt]))) | |
99 delete (["*." arg.fmt]); | |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
100 endif |
18895 | 101 if (! strcmp (arg.toolkits{n}, "matlab")) |
102 close all; | |
103 graphics_toolkit (arg.toolkits{n}); | |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
104 try |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
105 eval (fcn_name); |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
106 catch |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
107 printf ("Error running plot demos for ""%s"" toolkit\n", |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19152
diff
changeset
|
108 arg.toolkits{n}); |
18895 | 109 disp (lasterror); |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
110 end_try_catch |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
111 endif |
18895 | 112 cd (cwd); |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
113 endfor |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
114 unwind_protect_cleanup |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
115 rmpath (cwd); |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
116 end_unwind_protect |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
117 |
18925
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18897
diff
changeset
|
118 if (! strcmp (arg.toolkits, "matlab")) |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18897
diff
changeset
|
119 ## Generate the html comparison of the images |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18897
diff
changeset
|
120 html_compare_plot_demos (arg.toolkits); |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18897
diff
changeset
|
121 else |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18897
diff
changeset
|
122 ## We need to run matlab manually before the html page can be created |
21634
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
123 printf ('\nNow run %s in Matlab.\nAfter this run html_compare_plot_demos,\n', arg.fcn_file); |
96518f623c91
Backed out changeset dcf8922b724b
Mike Miller <mtmiller@octave.org>
parents:
21633
diff
changeset
|
124 printf ('for example html_compare_plot_demos ({"fltk", "gnuplot", "matlab"}), to create the html page.\n'); |
18925
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
18897
diff
changeset
|
125 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21634
diff
changeset
|
126 |
18874
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
127 endfunction |