Mercurial > hg > octave-nkf
annotate scripts/plot/hold.m @ 14363:f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
* wavread.m, acosd.m, acot.m, acotd.m, acoth.m, acsc.m, acscd.m, acsch.m,
asec.m, asecd.m, asech.m, asind.m, atand.m, cosd.m, cot.m, cotd.m, coth.m,
csc.m, cscd.m, csch.m, sec.m, secd.m, sech.m, sind.m, tand.m, accumarray.m,
accumdim.m, bitcmp.m, bitget.m, bitset.m, blkdiag.m, cart2pol.m, cart2sph.m,
celldisp.m, chop.m, circshift.m, colon.m, common_size.m, cplxpair.m,
cumtrapz.m, curl.m, dblquad.m, deal.m, divergence.m, flipdim.m, fliplr.m,
flipud.m, genvarname.m, gradient.m, idivide.m, int2str.m, interp1.m,
interp1q.m, interp2.m, interp3.m, interpft.m, interpn.m, isa.m, isdir.m,
isequal.m, isequalwithequalnans.m, issquare.m, logspace.m, nargchk.m,
narginchk.m, nargoutchk.m, nextpow2.m, nthargout.m, num2str.m, pol2cart.m,
polyarea.m, postpad.m, prepad.m, profile.m, profshow.m, quadgk.m, quadv.m,
randi.m, rat.m, repmat.m, rot90.m, rotdim.m, shift.m, shiftdim.m, sph2cart.m,
structfun.m, trapz.m, triplequad.m, convhull.m, dsearch.m, dsearchn.m,
griddata3.m, griddatan.m, rectint.m, tsearchn.m, __makeinfo__.m, doc.m,
get_first_help_sentence.m, help.m, type.m, unimplemented.m, which.m, imread.m,
imwrite.m, dlmwrite.m, fileread.m, is_valid_file_id.m, strread.m, textread.m,
textscan.m, commutation_matrix.m, cond.m, condest.m, cross.m,
duplication_matrix.m, expm.m, housh.m, isdefinite.m, ishermitian.m,
issymmetric.m, logm.m, normest.m, null.m, onenormest.m, orth.m, planerot.m,
qzhess.m, rank.m, rref.m, trace.m, vech.m, ans.m, bincoeff.m, bug_report.m,
bzip2.m, comma.m, compare_versions.m, computer.m, edit.m, fileparts.m,
fullfile.m, getfield.m, gzip.m, info.m, inputname.m, isappdata.m, isdeployed.m,
ismac.m, ispc.m, isunix.m, list_primes.m, ls.m, mexext.m, namelengthmax.m,
news.m, orderfields.m, paren.m, recycle.m, rmappdata.m, semicolon.m,
setappdata.m, setfield.m, substruct.m, symvar.m, ver.m, version.m,
warning_ids.m, xor.m, fminbnd.m, fsolve.m, fzero.m, lsqnonneg.m, optimset.m,
pqpnonneg.m, sqp.m, matlabroot.m, __gnuplot_drawnow__.m,
__plt_get_axis_arg__.m, ancestor.m, cla.m, clf.m, close.m, colorbar.m,
colstyle.m, comet3.m, contourc.m, figure.m, gca.m, gcbf.m, gcbo.m, gcf.m,
ginput.m, graphics_toolkit.m, gtext.m, hggroup.m, hist.m, hold.m, isfigure.m,
ishghandle.m, ishold.m, isocolors.m, isonormals.m, isosurface.m, isprop.m,
legend.m, line.m, loglog.m, loglogerr.m, meshgrid.m, ndgrid.m, newplot.m,
orient.m, patch.m, plot3.m, plotyy.m, __print_parse_opts__.m, quiver3.m,
refreshdata.m, ribbon.m, semilogx.m, semilogxerr.m, semilogy.m, stem.m,
stem3.m, subplot.m, title.m, uigetfile.m, view.m, whitebg.m, compan.m, conv.m,
deconv.m, mkpp.m, mpoles.m, pchip.m, poly.m, polyaffine.m, polyder.m,
polyfit.m, polygcd.m, polyint.m, polyout.m, polyval.m, polyvalm.m, ppder.m,
ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, intersect.m,
ismember.m, powerset.m, setdiff.m, setxor.m, union.m, unique.m,
autoreg_matrix.m, bartlett.m, blackman.m, detrend.m, fftconv.m, fftfilt.m,
fftshift.m, freqz.m, hamming.m, hanning.m, ifftshift.m, sinc.m, sinetone.m,
sinewave.m, unwrap.m, bicg.m, bicgstab.m, gmres.m, gplot.m, nonzeros.m, pcg.m,
pcr.m, spaugment.m, spconvert.m, spdiags.m, speye.m, spfun.m, spones.m,
sprand.m, sprandsym.m, spstats.m, spy.m, svds.m, treelayout.m, bessel.m,
beta.m, betaln.m, factor.m, factorial.m, isprime.m, lcm.m, legendre.m,
nchoosek.m, nthroot.m, perms.m, pow2.m, primes.m, reallog.m, realpow.m,
realsqrt.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, rosser.m,
vander.m, __finish__.m, center.m, cloglog.m, corr.m, cov.m, gls.m, histc.m,
iqr.m, kendall.m, kurtosis.m, logit.m, mahalanobis.m, mean.m, meansq.m,
median.m, mode.m, moment.m, ols.m, ppplot.m, prctile.m, probit.m, quantile.m,
range.m, ranks.m, run_count.m, runlength.m, skewness.m, spearman.m,
statistics.m, std.m, table.m, var.m, zscore.m, betacdf.m, betainv.m, betapdf.m,
betarnd.m, binocdf.m, binoinv.m, binopdf.m, binornd.m, cauchy_cdf.m,
cauchy_inv.m, cauchy_pdf.m, cauchy_rnd.m, chi2cdf.m, chi2inv.m, chi2pdf.m,
chi2rnd.m, discrete_cdf.m, discrete_inv.m, discrete_pdf.m, discrete_rnd.m,
empirical_cdf.m, empirical_inv.m, empirical_pdf.m, empirical_rnd.m, expcdf.m,
expinv.m, exppdf.m, exprnd.m, fcdf.m, finv.m, fpdf.m, frnd.m, gamcdf.m,
gaminv.m, gampdf.m, gamrnd.m, geocdf.m, geoinv.m, geopdf.m, geornd.m,
hygecdf.m, hygeinv.m, hygepdf.m, hygernd.m, kolmogorov_smirnov_cdf.m,
laplace_cdf.m, laplace_inv.m, laplace_pdf.m, laplace_rnd.m, logistic_cdf.m,
logistic_inv.m, logistic_pdf.m, logistic_rnd.m, logncdf.m, logninv.m,
lognpdf.m, lognrnd.m, nbincdf.m, nbininv.m, nbinpdf.m, nbinrnd.m, normcdf.m,
norminv.m, normpdf.m, normrnd.m, poisscdf.m, poissinv.m, poisspdf.m,
poissrnd.m, stdnormal_cdf.m, stdnormal_inv.m, stdnormal_pdf.m, stdnormal_rnd.m,
tcdf.m, tinv.m, tpdf.m, trnd.m, unidcdf.m, unidinv.m, unidpdf.m, unidrnd.m,
unifcdf.m, unifinv.m, unifpdf.m, unifrnd.m, wblcdf.m, wblinv.m, wblpdf.m,
wblrnd.m, kolmogorov_smirnov_test.m, kruskal_wallis_test.m, base2dec.m,
bin2dec.m, blanks.m, cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m,
findstr.m, hex2dec.m, index.m, isletter.m, mat2str.m, rindex.m, str2num.m,
strcat.m, strjust.m, strmatch.m, strsplit.m, strtok.m, strtrim.m, strtrunc.m,
substr.m, validatestring.m, demo.m, example.m, fail.m, speed.m, addtodate.m,
asctime.m, clock.m, ctime.m, date.m, datenum.m, datetick.m, datevec.m,
eomday.m, etime.m, is_leap_year.m, now.m:
Use Octave coding conventions in all m-file %!test blocks
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 13 Feb 2012 07:29:44 -0800 |
parents | 7277fe922e99 |
children | 0322e057697f |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13204
diff
changeset
|
1 ## Copyright (C) 2005-2012 John W. Eaton |
5406 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5406 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5406 | 18 |
19 ## -*- texinfo -*- | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
20 ## @deftypefn {Command} {} hold |
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
21 ## @deftypefnx {Command} {} hold @var{state} |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
22 ## @deftypefnx {Function File} {} hold (@var{hax}, @dots{}) |
14359
7277fe922e99
doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents:
14252
diff
changeset
|
23 ## Toggle or set the "hold" state of the plotting engine which determines |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
24 ## whether new graphic objects are added to the plot or replace the existing |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
25 ## objects. |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
26 ## |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
27 ## @table @code |
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
28 ## @item hold on |
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
29 ## Retain plot data and settings so that subsequent plot commands are displayed |
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
30 ## on a single graph. |
5406 | 31 ## |
10770
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
32 ## @item hold all |
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
33 ## Retain plot line color, line style, data and settings so that subsequent |
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
34 ## plot commands are displayed on a single graph with the next line color and |
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
35 ## style. |
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
36 ## |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
37 ## @item hold off |
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
38 ## Clear plot and restore default graphics settings before each new plot |
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
39 ## command. (default). |
7985
85c5c1d55820
hold.m: Trival mod to help text.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
40 ## |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
41 ## @item hold |
14359
7277fe922e99
doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents:
14252
diff
changeset
|
42 ## Toggle the current hold state. |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
43 ## @end table |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11563
diff
changeset
|
44 ## |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
45 ## When given the additional argument @var{hax}, the hold state is modified |
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
46 ## only for the given axis handle. |
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
47 ## |
14359
7277fe922e99
doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents:
14252
diff
changeset
|
48 ## To query the current hold state use the @code{ishold} function. |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
9272
diff
changeset
|
49 ## @seealso{ishold, cla, newplot, clf} |
5406 | 50 ## @end deftypefn |
51 | |
6257 | 52 function hold (varargin) |
5406 | 53 |
9618
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
54 if (nargin > 0 && numel (varargin{1}) == 1 && ishandle (varargin{1}) |
8240
5cfeb7bc497a
comet.m,hold.m: validate axes handle
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
55 && strcmp (get (varargin{1}, "type"), "axes")) |
9618
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
56 [ax, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:}); |
10916
5074494f01a9
allow hold to work if given axis handle
Pascal A. Dupuis <Pascal.Dupuis@worldonline.be>
parents:
10770
diff
changeset
|
57 fig = get (ax, "parent"); |
9618
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
58 elseif (nargin > 0 && numel (varargin{1}) > 1 && ishandle (varargin{1})) |
8189
8e8afefe9466
Remove reliance on ishandle(vec) == false.
Ben Abbott <bpabbott@mac.com>
parents:
8075
diff
changeset
|
59 print_usage (); |
8065
6333da0dfdfd
hold.m: if hold is applied to a figure, set state for all child axes objects
John W. Eaton <jwe@octave.org>
parents:
7985
diff
changeset
|
60 else |
9618
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
61 ax = gca (); |
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
62 fig = gcf (); |
8065
6333da0dfdfd
hold.m: if hold is applied to a figure, set state for all child axes objects
John W. Eaton <jwe@octave.org>
parents:
7985
diff
changeset
|
63 nargs = numel (varargin); |
6333da0dfdfd
hold.m: if hold is applied to a figure, set state for all child axes objects
John W. Eaton <jwe@octave.org>
parents:
7985
diff
changeset
|
64 endif |
5406 | 65 |
10770
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
66 hold_all = false; |
6257 | 67 if (nargs == 0) |
9618
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
68 turn_hold_off = ishold (ax); |
6257 | 69 elseif (nargs == 1) |
70 state = varargin{1}; | |
71 if (ischar (state)) | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8189
diff
changeset
|
72 if (strcmpi (state, "off")) |
10549 | 73 turn_hold_off = true; |
10770
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
74 elseif (strcmpi (state, "all")) |
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
75 turn_hold_off = false; |
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
76 hold_all = true; |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8189
diff
changeset
|
77 elseif (strcmpi (state, "on")) |
10549 | 78 turn_hold_off = false; |
6257 | 79 else |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
10916
diff
changeset
|
80 error ("hold: invalid hold STATE"); |
6257 | 81 endif |
5406 | 82 endif |
83 else | |
6046 | 84 print_usage (); |
5406 | 85 endif |
86 | |
9618
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
87 if (turn_hold_off) |
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
88 set (ax, "nextplot", "replace"); |
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
89 else |
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
90 set (ax, "nextplot", "add"); |
e381f80a5f7a
correctly toggle hold state
John W. Eaton <jwe@octave.org>
parents:
9328
diff
changeset
|
91 set (fig, "nextplot", "add"); |
8065
6333da0dfdfd
hold.m: if hold is applied to a figure, set state for all child axes objects
John W. Eaton <jwe@octave.org>
parents:
7985
diff
changeset
|
92 endif |
10770
84c35a483d1f
Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
93 set (ax, "__hold_all__", hold_all); |
8065
6333da0dfdfd
hold.m: if hold is applied to a figure, set state for all child axes objects
John W. Eaton <jwe@octave.org>
parents:
7985
diff
changeset
|
94 |
5406 | 95 endfunction |
9272
3eda945bda43
__go_draw_axes__.m: Fix rendering of overlaping images and line objects. Add demos as well.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
96 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
97 |
9272
3eda945bda43
__go_draw_axes__.m: Fix rendering of overlaping images and line objects. Add demos as well.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
98 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
99 %! clf; |
9272
3eda945bda43
__go_draw_axes__.m: Fix rendering of overlaping images and line objects. Add demos as well.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
100 %! A = rand (100); |
3eda945bda43
__go_draw_axes__.m: Fix rendering of overlaping images and line objects. Add demos as well.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
101 %! [X, Y] = find (A > 0.9); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
102 %! imshow (A); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
103 %! hold on; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
104 %! plot (X, Y, 'o'); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
105 %! hold off; |
9272
3eda945bda43
__go_draw_axes__.m: Fix rendering of overlaping images and line objects. Add demos as well.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
106 |
3eda945bda43
__go_draw_axes__.m: Fix rendering of overlaping images and line objects. Add demos as well.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
107 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
108 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
109 %! colormap ('default'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
110 %! hold on; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
111 %! imagesc (1 ./ hilb (4)); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
112 %! plot (1:4, '-s'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
113 %! hold off; |
9272
3eda945bda43
__go_draw_axes__.m: Fix rendering of overlaping images and line objects. Add demos as well.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
114 |
3eda945bda43
__go_draw_axes__.m: Fix rendering of overlaping images and line objects. Add demos as well.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
115 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
116 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
117 %! colormap ('default'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
118 %! hold on; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
119 %! imagesc (1 ./ hilb (2)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
120 %! imagesc (1 ./ hilb (4)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
121 %! hold off; |
9272
3eda945bda43
__go_draw_axes__.m: Fix rendering of overlaping images and line objects. Add demos as well.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
122 |
9328
0307f5e5568c
__go_draw_axes__.m: Fix order when pushing group children onto kid list.
Ben Abbott <bpabbott@mac.com>
parents:
9316
diff
changeset
|
123 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
124 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
125 %! colormap ('default'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
126 %! hold on; |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
127 %! plot (1:4, '-s'); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
128 %! imagesc (1 ./ hilb (4)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
129 %! hold off; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
130 |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
131 %!demo |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
132 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
133 %! colormap ('default'); |
9328
0307f5e5568c
__go_draw_axes__.m: Fix order when pushing group children onto kid list.
Ben Abbott <bpabbott@mac.com>
parents:
9316
diff
changeset
|
134 %! t = linspace (-3, 3, 50); |
0307f5e5568c
__go_draw_axes__.m: Fix order when pushing group children onto kid list.
Ben Abbott <bpabbott@mac.com>
parents:
9316
diff
changeset
|
135 %! [x, y] = meshgrid (t, t); |
0307f5e5568c
__go_draw_axes__.m: Fix order when pushing group children onto kid list.
Ben Abbott <bpabbott@mac.com>
parents:
9316
diff
changeset
|
136 %! z = peaks (x, y); |
0307f5e5568c
__go_draw_axes__.m: Fix order when pushing group children onto kid list.
Ben Abbott <bpabbott@mac.com>
parents:
9316
diff
changeset
|
137 %! contourf (x, y, z, 10); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
138 %! hold on; |
14252
4e6436a60b62
Changes to allow plot demos to be run under Matlab.
Ben Abbott <bpabbott@mac.com>
parents:
14247
diff
changeset
|
139 %! plot (x(:), y(:), '^'); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
140 %! patch ([-1.0 1.0 1.0 -1.0 -1.0], [-1.0 -1.0 1.0 1.0 -1.0], 'red'); |
9328
0307f5e5568c
__go_draw_axes__.m: Fix order when pushing group children onto kid list.
Ben Abbott <bpabbott@mac.com>
parents:
9316
diff
changeset
|
141 %! xlim ([-2.0 2.0]); |
0307f5e5568c
__go_draw_axes__.m: Fix order when pushing group children onto kid list.
Ben Abbott <bpabbott@mac.com>
parents:
9316
diff
changeset
|
142 %! ylim ([-2.0 2.0]); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
143 %! colorbar ('SouthOutside'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
144 %! title ('Test script for some plot functions'); |
9328
0307f5e5568c
__go_draw_axes__.m: Fix order when pushing group children onto kid list.
Ben Abbott <bpabbott@mac.com>
parents:
9316
diff
changeset
|
145 |
13204 | 146 ##hold on |
147 %!test | |
148 %! hf = figure ("visible", "off"); | |
149 %! unwind_protect | |
150 %! p = plot ([0 1]); | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
151 %! assert (! ishold); |
13204 | 152 %! hold on; |
153 %! assert (ishold); | |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
154 %! p1 = fill ([0 1 1], [0 0 1], "black"); |
13204 | 155 %! p2 = fill ([0 1 0], [0 1 1], "red"); |
156 %! assert (length (get (hf, "children")), 1); | |
157 %! assert (length (get (gca, "children")), 3); | |
158 %! unwind_protect_cleanup | |
159 %! close (hf); | |
160 %! end_unwind_protect | |
161 | |
162 ##hold off | |
163 %!test | |
164 %! hf = figure ("visible", "off"); | |
165 %! unwind_protect | |
166 %! p = plot ([0 1]); | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
167 %! assert (! ishold); |
13204 | 168 %! hold on; |
169 %! assert (ishold); | |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
170 %! p1 = fill ([0 1 1], [0 0 1], "black"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
171 %! hold off; |
13204 | 172 %! p2 = fill ([0 1 0], [0 1 1], "red"); |
173 %! assert (length (get (hf, "children")), 1); | |
174 %! assert (length (get (gca, "children")), 1); | |
175 %! unwind_protect_cleanup | |
176 %! close (hf); | |
177 %! end_unwind_protect | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
178 |