annotate scripts/plot/plotmatrix.m @ 14868:5d3a684236b0

maint: Use Octave coding conventions for cuddling parentheses in scripts directory * lin2mu.m, loadaudio.m, wavread.m, accumarray.m, bicubic.m, celldisp.m, colon.m, cplxpair.m, dblquad.m, divergence.m, genvarname.m, gradient.m, int2str.m, interp1.m, interp1q.m, interp2.m, interpn.m, loadobj.m, nthargout.m, __isequal__.m, __splinen__.m, quadgk.m, quadl.m, quadv.m, rat.m, rot90.m, rotdim.m, saveobj.m, subsindex.m, triplequad.m, delaunay3.m, griddata.m, inpolygon.m, tsearchn.m, voronoi.m, get_first_help_sentence.m, which.m, gray2ind.m, pink.m, dlmwrite.m, strread.m, textread.m, textscan.m, housh.m, ishermitian.m, issymmetric.m, krylov.m, logm.m, null.m, rref.m, compare_versions.m, copyfile.m, dump_prefs.m, edit.m, fileparts.m, getappdata.m, isappdata.m, movefile.m, orderfields.m, parseparams.m, __xzip__.m, rmappdata.m, setappdata.m, swapbytes.m, unpack.m, ver.m, fminbnd.m, fminunc.m, fsolve.m, glpk.m, lsqnonneg.m, qp.m, sqp.m, configure_make.m, copy_files.m, describe.m, get_description.m, get_forge_pkg.m, install.m, installed_packages.m, is_architecture_dependent.m, load_package_dirs.m, print_package_description.m, rebuild.m, repackage.m, save_order.m, shell.m, allchild.m, ancestor.m, area.m, axes.m, axis.m, clabel.m, close.m, colorbar.m, comet.m, comet3.m, contour.m, cylinder.m, ezmesh.m, ezsurf.m, findobj.m, fplot.m, hist.m, isocolors.m, isonormals.m, isosurface.m, isprop.m, legend.m, mesh.m, meshz.m, pareto.m, pcolor.m, peaks.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, print.m, __add_datasource__.m, __add_default_menu__.m, __axes_limits__.m, __bar__.m, __clabel__.m, __contour__.m, __errcomm__.m, __errplot__.m, __ezplot__.m, __file_filter__.m, __fltk_print__.m, __ghostscript__.m, __gnuplot_print__.m, __go_draw_axes__.m, __go_draw_figure__.m, __interp_cube__.m, __marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __print_parse_opts__.m, __quiver__.m, __scatter__.m, __stem__.m, __tight_eps_bbox__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiputfile_fltk__.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m, scatter.m, semilogy.m, shading.m, slice.m, subplot.m, surface.m, surfl.m, surfnorm.m, text.m, uigetfile.m, uiputfile.m, whitebg.m, deconv.m, mkpp.m, pchip.m, polyaffine.m, polyder.m, polygcd.m, polyout.m, polyval.m, ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, addpref.m, getpref.m, setpref.m, ismember.m, setxor.m, arch_fit.m, arch_rnd.m, arch_test.m, autoreg_matrix.m, diffpara.m, fftconv.m, filter2.m, hanning.m, hurst.m, periodogram.m, triangle_sw.m, sinc.m, spectral_xdf.m, spencer.m, stft.m, synthesis.m, unwrap.m, yulewalker.m, bicgstab.m, gmres.m, pcg.m, pcr.m, __sprand_impl__.m, speye.m, spfun.m, sprandn.m, spstats.m, svds.m, treelayout.m, treeplot.m, bessel.m, factor.m, legendre.m, perms.m, primes.m, magic.m, toeplitz.m, corr.m, cov.m, mean.m, median.m, mode.m, qqplot.m, quantile.m, ranks.m, zscore.m, logistic_regression_likelihood.m, bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m, kolmogorov_smirnov_test.m, run_test.m, u_test.m, wilcoxon_test.m, z_test.m, z_test_2.m, bin2dec.m, dec2base.m, mat2str.m, strcat.m, strchr.m, strjust.m, strtok.m, substr.m, untabify.m, assert.m, demo.m, example.m, fail.m, speed.m, test.m, now.m: Use Octave coding conventions for cuddling parentheses in scripts directory.
author Rik <octave@nomad.inbox5.com>
date Tue, 17 Jul 2012 07:08:39 -0700
parents ce2b59a6d0e5
children f89760972bf4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 14092
diff changeset
1 ## Copyright (C) 2008-2012 David Bateman
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
2 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
3 ## This file is part of Octave.
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
4 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 ## your option) any later version.
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
9 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
13 ## General Public License for more details.
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
18
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
19 ## -*- texinfo -*-
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
20 ## @deftypefn {Function File} {} plotmatrix (@var{x}, @var{y})
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
21 ## @deftypefnx {Function File} {} plotmatrix (@var{x})
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
22 ## @deftypefnx {Function File} {} plotmatrix (@dots{}, @var{style})
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
23 ## @deftypefnx {Function File} {} plotmatrix (@var{h}, @dots{})
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
24 ## @deftypefnx {Function File} {[@var{h}, @var{ax}, @var{bigax}, @var{p}, @var{pax}] =} plotmatrix (@dots{})
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8190
diff changeset
25 ## Scatter plot of the columns of one matrix against another. Given the
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
26 ## arguments @var{x} and @var{y}, that have a matching number of rows,
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
27 ## @code{plotmatrix} plots a set of axes corresponding to
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
28 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
29 ## @example
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
30 ## plot (@var{x} (:, i), @var{y} (:, j)
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
31 ## @end example
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
32 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
33 ## Given a single argument @var{x}, then this is equivalent to
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
34 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
35 ## @example
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
36 ## plotmatrix (@var{x}, @var{x})
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
37 ## @end example
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
38 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
39 ## @noindent
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
40 ## except that the diagonal of the set of axes will be replaced with the
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
41 ## histogram @code{hist (@var{x} (:, i))}.
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
42 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
43 ## The marker to use can be changed with the @var{style} argument, that is a
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
44 ## string defining a marker in the same manner as the @code{plot}
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8190
diff changeset
45 ## command. If a leading axes handle @var{h} is passed to
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
46 ## @code{plotmatrix}, then this axis will be used for the plot.
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
47 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
48 ## The optional return value @var{h} provides handles to the individual
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
49 ## graphics objects in the scatter plots, whereas @var{ax} returns the
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8190
diff changeset
50 ## handles to the scatter plot axis objects. @var{bigax} is a hidden
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
51 ## axis object that surrounds the other axes, such that the commands
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
52 ## @code{xlabel}, @code{title}, etc., will be associated with this hidden
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8190
diff changeset
53 ## axis. Finally @var{p} returns the graphics objects associated with
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
54 ## the histogram and @var{pax} the corresponding axes objects.
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
55 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
56 ## @example
14327
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
57 ## plotmatrix (randn (100, 3), "g+")
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
58 ## @end example
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
59 ##
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
60 ## @end deftypefn
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
61
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
62 function [h, ax, bigax, p, pax] = plotmatrix (varargin)
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
63
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
64 [bigax2, varargin, nargin] = __plt_get_axis_arg__ ("plotmatrix", varargin{:});
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
65
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
66 if (nargin > 3 || nargin < 1)
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
67 print_usage ();
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
68 else
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
69 oldh = gca ();
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
70 unwind_protect
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
71 axes (bigax2);
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
72 newplot ();
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
73 [h2, ax2, p2, pax2, need_usage] = __plotmatrix__ (bigax2, varargin{:});
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
74 if (need_usage)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
75 print_usage ();
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
76 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
77 if (nargout > 0)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
78 h = h2;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
79 ax = ax2;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
80 bigax = bigax2;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
81 p = p2;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
82 pax = pax2;
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
83 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
84 axes (bigax2);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
85 ctext = text (0, 0, "", "visible", "off",
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
86 "handlevisibility", "off", "xliminclude", "off",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
87 "yliminclude", "off", "zliminclude", "off",
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
88 "deletefcn", {@plotmatrixdelete, [ax2; pax2]});
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
89 set (bigax2, "visible", "off");
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
90 unwind_protect_cleanup
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
91 axes (oldh);
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
92 end_unwind_protect
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
93 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
94 endfunction
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
95
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
96 %!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
97 %! clf;
14245
4506eade9f04 Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
98 %! plotmatrix (randn (100, 3), 'g+');
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
99
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
100 function plotmatrixdelete (h, d, ax)
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
101 for i = 1 : numel (ax)
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
102 hc = ax(i);
11149
fe3c3dfc07eb style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
103 if (ishandle (hc) && strcmp (get (hc, "type"), "axes")
fe3c3dfc07eb style fix: break lines before && and ||, not after
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
104 && strcmpi (get (hc, "beingdeleted"), "off"))
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
105 parent = get (hc, "parent");
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
106 ## If the parent is invalid or being deleted, then do nothing
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 8127
diff changeset
107 if (ishandle (parent) && strcmpi (get (parent, "beingdeleted"), "off"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
108 delete (hc);
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
109 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
110 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
111 endfor
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
112 endfunction
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
113
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
114 function [h, ax, p, pax, need_usage] = __plotmatrix__ (bigax, varargin)
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
115 need_usage = false;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
116 have_line_spec = false;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
117 have_hist = false;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
118 parent = get (bigax, "parent");
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
119 for i = 1 : nargin - 1
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
120 arg = varargin{i};
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
121 if (ischar (arg) || iscell (arg))
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
122 [linespec, valid] = __pltopt__ ("plotmatrix", varargin{i}, false);
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
123 if (valid)
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
124 have_line_spec = true;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
125 linespec = varargin(i);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
126 varargin(i) = [];
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
127 nargin = nargin - 1;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
128 break;
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
129 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
130 need_usage = true;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
131 returm;
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
132 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
133 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
134 endfor
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
135
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
136 if (nargin == 2)
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
137 X = varargin{1};
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
138 Y = X;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
139 have_hist = true;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
140 elseif (nargin == 3)
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
141 X = varargin{1};
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
142 Y = varargin{2};
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
143 else
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
144 need_usage = true;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
145 returm;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
146 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
147
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14335
diff changeset
148 if (rows (X) != rows (Y))
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
149 error ("plotmatrix: dimension mismatch in the arguments");
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
150 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
151
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
152 [dummy, m] = size (X);
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
153 [dummy, n] = size (Y);
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
154
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
155 h = [];
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
156 ax = [];
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
157 p = [];
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
158 pax = [];
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
159
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
160 xsize = 0.9 / m;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
161 ysize = 0.9 / n;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
162 xoff = 0.05;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
163 yoff = 0.05;
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
164 border = [0.130, 0.110, 0.225, 0.185] .* [xsize, ysize, xsize, ysize];
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
165 border(3:4) = - border(3:4) - border(1:2);
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
166
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
167 for i = 1 : n
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
168 for j = 1 : m
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
169 pos = [xsize * (j - 1) + xoff, ysize * (n - i) + yoff, xsize, ysize];
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
170 tmp = axes ("outerposition", pos, "position", pos + border,
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
171 "parent", parent);
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
172 if (i == j && have_hist)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
173 pax = [pax ; tmp];
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
174 [nn, xx] = hist (X(:, i));
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
175 tmp = bar (xx, nn, 1.0);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
176 p = [p; tmp];
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
177 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
178 ax = [ax ; tmp];
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
179 if (have_line_spec)
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
180 tmp = plot (X (:, i), Y (:, j), linespec);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
181 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
182 tmp = plot (X (:, i), Y (:, j), ".");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
183 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
184 h = [h ; tmp];
8127
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
185 endif
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
186 endfor
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
187 endfor
86568be36992 Add the plotmatrix function
David Bateman <dbateman@free.fr>
parents:
diff changeset
188 endfunction