Mercurial > hg > octave-nkf
annotate scripts/testfun/private/compare_plot_demos.m @ 19344:0f9c5a15c8fa
doc: Periodic grammarcheck of documentation.
* doc/interpreter/contrib.txi, doc/interpreter/expr.txi,
doc/interpreter/func.txi, doc/interpreter/linalg.txi, doc/interpreter/plot.txi,
libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc,
libinterp/corefcn/graphics.cc, libinterp/corefcn/help.cc,
libinterp/corefcn/load-save.cc, libinterp/corefcn/profiler.cc,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/utils.cc,
libinterp/corefcn/variables.cc, libinterp/dldfcn/__init_fltk__.cc,
scripts/general/deal.m, scripts/help/__gripe_missing_component__.m,
scripts/miscellaneous/desktop.m, scripts/pkg/private/default_prefix.m,
scripts/plot/appearance/__getlegenddata__.m, scripts/plot/util/pan.m,
scripts/plot/util/rotate.m, scripts/plot/util/rotate3d.m,
scripts/plot/util/zoom.m, scripts/signal/periodogram.m,
scripts/specfun/factor.m, scripts/specfun/primes.m,
scripts/statistics/base/lscov.m, scripts/testfun/private/compare_plot_demos.m,
scripts/testfun/private/dump_demos.m,
scripts/testfun/private/html_compare_plot_demos.m, scripts/testfun/test.m:
Periodic grammarcheck of documentation.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 22 Sep 2014 20:46:54 -0700 |
parents | 87324260043d |
children | 9fc020886ae9 |
rev | line source |
---|---|
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
1 ## Copyright (C) 2012 Ben Abbott <bpabbott@mac.com> |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
2 ## |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
4 ## |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
8 ## your option) any later version. |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
9 ## |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
10 ## 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
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
13 ## General Public License for more details. |
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 ## 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
|
16 ## along with Octave; see the file COPYING. If not, see |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
18 |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
20 ## @deftypefn {Function File} {} compare_plot_demos () |
19085 | 21 ## @deftypefnx {Function File} {} compare_plot_demos ("toolkits", @{@var{toolkit1}, @var{toolkit2}, @dots{}@}) |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
22 ## |
19085 | 23 ## Uses @code{dump_demos} and @code{html_compare_plot_demos} to produce an |
19115
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
24 ## html comparison of the plot demos for each of Octave's graphics toolkits. |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
25 ## |
19085 | 26 ## An m-file named @file{dump_plots.m} will be created in the current working |
19344
0f9c5a15c8fa
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
19115
diff
changeset
|
27 ## directory. This function will be used to render and save the plot demo |
19085 | 28 ## images. |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
29 ## |
19085 | 30 ## If they do not already exist, directories for each available graphics |
31 ## toolkit are created. Each toolkit's directory will be populated with images | |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
32 ## of each plot demo in the png format. |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
33 ## |
19085 | 34 ## Finally, an html document named @file{compare_plot_demos.html} is produced. |
35 ## This page places each toolkit's images side by side for a convenient | |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
36 ## comparison of the results. |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
37 ## |
19085 | 38 ## If the property @qcode{"toolkits"} is given then compare only the listed |
39 ## toolkits in the cell string. The list may also include the toolkit | |
40 ## @qcode{"matlab"}. | |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
41 ## |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
42 ## @end deftypefn |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
43 |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
44 ## Author: Ben Abbott <bpabbott@mac.com> |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
45 |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
46 function compare_plot_demos (varargin) |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
47 |
19085 | 48 arg.toolkits = available_graphics_toolkits (); |
19087
f9cf5ae6b8a2
Add image directory to plot comparison scripts.
Rik <rik@octave.org>
parents:
19085
diff
changeset
|
49 arg.directories = {"plot/appearance", "plot/draw", "plot/util", "image"}; |
19085 | 50 arg.fmt = "png"; |
19115
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
51 arg.fcn_file = "dump_plot_demos.m"; |
19085 | 52 arg.replace_images = false; |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
53 |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
54 for n = 1:2:numel(varargin) |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
55 if (! ischar (varargin{n})) |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
56 print_usage (); |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
57 else |
19085 | 58 arg.(varargin{n}) = varargin{n+1}; |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
59 endif |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
60 endfor |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
61 |
19085 | 62 if (ischar (arg.toolkits)) |
63 arg.toolkits = {arg.toolkits}; | |
64 elseif (! iscellstr (arg.toolkits)) | |
65 error ('compare_plot_demos: Invalid value for "toolkits"') | |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
66 endif |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
67 |
19085 | 68 if (ischar (arg.directories)) |
69 arg.directories = {arg.directories}; | |
70 elseif (! iscellstr (arg.directories)) | |
71 error ('compare_plot_demos: Invalid value for "directory"') | |
19064
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 |
19085 | 74 if (! ischar (arg.fmt)) |
75 error ('compare_plot_demos: Invalid value for "fmt"') | |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
76 endif |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
77 |
19115
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
78 ## Generate arg.fcn_file for rendering/saving the plot demo images |
19085 | 79 dump_demos (arg.directories, arg.fcn_file, arg.fmt); |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
80 |
19085 | 81 [~, fcn_name] = fileparts (arg.fcn_file); |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
82 |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
83 ## Generate the plot demo images for each toolkit |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
84 cwd = pwd (); |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
85 unwind_protect |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
86 addpath (pwd); |
19085 | 87 for n = 1:numel (arg.toolkits) |
88 if (! isdir (fullfile (cwd, arg.toolkits{n}))) | |
89 mkdir (arg.toolkits{n}); | |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
90 endif |
19085 | 91 cd (arg.toolkits{n}); |
92 if (arg.replace_images && ! isempty (dir (["*." arg.fmt]))) | |
93 delete (["*." arg.fmt]); | |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
94 endif |
19085 | 95 if (! strcmp (arg.toolkits{n}, "matlab")) |
96 close all; | |
97 graphics_toolkit (arg.toolkits{n}); | |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
98 try |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
99 eval (fcn_name); |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
100 catch |
19085 | 101 printf ("Error running plot demos for ""%s"" toolkit\n", arg.toolkits{n}); |
102 disp (lasterror); | |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
103 end_try_catch |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
104 endif |
19085 | 105 cd (cwd); |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
106 endfor |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
107 unwind_protect_cleanup |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
108 rmpath (cwd); |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
109 end_unwind_protect |
19115
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
110 if (! strcmp (arg.toolkits, "matlab")) |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
111 ## Generate the html comparison of the images |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
112 html_compare_plot_demos (arg.toolkits); |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
113 else |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
114 ## We need to run matlab manually before the html page can be created |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
115 printf ('\nNow run %s in Matlab.\nAfter this run html_compare_plot_demos,\n', arg.fcn_file); |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
116 printf ('for example html_compare_plot_demos ({"fltk", "gnuplot", "matlab"}), to create the html page.\n'); |
87324260043d
Improve plot comparison scripts.
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19087
diff
changeset
|
117 endif |
19064
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
118 endfunction |
c74673161752
Add scripts to help validate plot results.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
119 |