Mercurial > hg > octave-lyh
annotate scripts/plot/pcolor.m @ 16816:12005245b645
doc: Periodic grammarcheck of documentation.
* doc/interpreter/basics.txi, doc/interpreter/container.txi,
doc/interpreter/contrib.txi, doc/interpreter/diagperm.txi,
doc/interpreter/errors.txi, doc/interpreter/install.txi,
doc/interpreter/sparse.txi, libinterp/corefcn/ellipj.cc,
libinterp/corefcn/mappers.cc, libinterp/corefcn/regexp.cc,
libinterp/corefcn/tril.cc, libinterp/dldfcn/__init_fltk__.cc,
libinterp/dldfcn/fftw.cc, libinterp/interpfcn/dirfns.cc,
libinterp/interpfcn/input.cc, libinterp/octave-value/ov-fcn-inline.cc,
libinterp/octave-value/ov-struct.cc, scripts/@ftp/cd.m,
scripts/general/interp1.m, scripts/general/num2str.m, scripts/image/ind2rgb.m,
scripts/image/rgb2ind.m, scripts/io/importdata.m, scripts/io/textread.m,
scripts/java/javamem.m, scripts/linear-algebra/condest.m,
scripts/linear-algebra/onenormest.m, scripts/miscellaneous/error_ids.m,
scripts/miscellaneous/getfield.m, scripts/miscellaneous/setfield.m,
scripts/plot/area.m, scripts/plot/pcolor.m, scripts/plot/stairs.m,
scripts/set/powerset.m, scripts/sparse/bicg.m, scripts/sparse/bicgstab.m,
scripts/sparse/cgs.m, scripts/specfun/ellipke.m,
scripts/special-matrix/gallery.m, scripts/strings/strjoin.m,
scripts/strings/strsplit.m, scripts/testfun/__have_feature__.m,
scripts/testfun/__printf_assert__.m, scripts/testfun/__prog_output_assert__.m,
scripts/testfun/__run_test_suite__.m: grammarcheck documentation.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 22 Jun 2013 19:47:32 -0700 |
parents | 64e7bb01fce2 |
children | 0de31fe43c4d |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14092
diff
changeset
|
1 ## Copyright (C) 2007-2012 Kai Habel |
7109 | 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 | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
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 | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
9245
diff
changeset
|
20 ## @deftypefn {Function File} {} pcolor (@var{x}, @var{y}, @var{c}) |
7109 | 21 ## @deftypefnx {Function File} {} pcolor (@var{c}) |
16816
12005245b645
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
22 ## Produce a density plot for matrices @var{x} and @var{y} from |
12005245b645
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
23 ## @code{meshgrid}, and a matrix @var{c} corresponding to the @var{x} and |
12005245b645
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
24 ## @var{y} coordinates of the mesh's vertices. If @var{x} and @var{y} are |
12005245b645
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
25 ## vectors, then a typical vertex is (@var{x}(j), @var{y}(i), @var{c}(i,j)). |
12005245b645
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
26 ## Thus, columns of @var{c} correspond to different @var{x} values and rows |
12005245b645
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
16814
diff
changeset
|
27 ## of @var{c} correspond to different @var{y} values. |
8132
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
28 ## |
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
29 ## The @code{colormap} is scaled to the extents of @var{c}. |
16814
64e7bb01fce2
doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
30 ## Limits may be placed on the color axis by the command @code{caxis}, or by |
64e7bb01fce2
doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
31 ## setting the @code{clim} property of the parent axis. |
8132
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
32 ## |
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
33 ## The face color of each cell of the mesh is determined by interpolating |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
34 ## the values of @var{c} for the cell's vertices. Contrast this with |
8132
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
35 ## @code{imagesc} which renders one cell for each element of @var{c}. |
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
36 ## |
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
37 ## @code{shading} modifies an attribute determining the manner by which the |
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
38 ## face color of each cell is interpolated from the values of @var{c}, |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
39 ## and the visibility of the cells' edges. By default the attribute is |
8132
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
40 ## "faceted", which renders a single color for each cell's face with the edge |
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
41 ## visible. |
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
42 ## |
16814
64e7bb01fce2
doc: Improve documentation for 2-D plot functions
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
43 ## The optional return value @var{h} is a handle to the surface object. |
8132
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
44 ## |
8139ddb83bc3
pcolor.m: Improve doc strings.
Ben Abbott <bpabbott@mac.com>
parents:
7337
diff
changeset
|
45 ## @seealso{caxis, contour, meshgrid, imagesc, shading} |
7109 | 46 ## @end deftypefn |
47 | |
7110 | 48 ## Author: Kai Habel <kai.habel@gmx.de> |
7109 | 49 |
7110 | 50 function h = pcolor (x, y, c) |
7109 | 51 |
52 newplot (); | |
53 | |
54 if (nargin == 1) | |
7110 | 55 c = x; |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14247
diff
changeset
|
56 [nr, nc] = size (c); |
7337 | 57 z = zeros (nr, nc); |
58 [x, y] = meshgrid (1:nc, 1:nr); | |
7109 | 59 elseif (nargin == 3) |
7110 | 60 z = zeros (size (c)); |
7109 | 61 else |
7110 | 62 print_usage (); |
63 endif | |
7109 | 64 |
7146 | 65 tmp = surface (x, y, z, c); |
7109 | 66 |
7110 | 67 ax = get (tmp, "parent"); |
68 | |
69 set (tmp, "facecolor", "flat"); | |
7271 | 70 set (ax, "box", "on"); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
71 |
7146 | 72 if (! ishold ()) |
73 set (ax, "view", [0, 90]); | |
74 endif | |
7110 | 75 |
7109 | 76 if (nargout > 0) |
77 h = tmp; | |
78 endif | |
79 | |
80 endfunction | |
12817
e3e6079039c6
codesprint: 2 demos for pcolor.m dummy for surface.m
Kai Habel <kai.habel@gmx.de>
parents:
11587
diff
changeset
|
81 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
82 |
12817
e3e6079039c6
codesprint: 2 demos for pcolor.m dummy for surface.m
Kai Habel <kai.habel@gmx.de>
parents:
11587
diff
changeset
|
83 %!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
|
84 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
85 %! 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
|
86 %! [~,~,Z] = peaks (); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
87 %! pcolor (Z); |
12817
e3e6079039c6
codesprint: 2 demos for pcolor.m dummy for surface.m
Kai Habel <kai.habel@gmx.de>
parents:
11587
diff
changeset
|
88 |
e3e6079039c6
codesprint: 2 demos for pcolor.m dummy for surface.m
Kai Habel <kai.habel@gmx.de>
parents:
11587
diff
changeset
|
89 %!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
|
90 %! clf; |
14247
c4fa5e0b6193
test: Make surface demos reproducible by setting colormap to default at start of demo.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
91 %! 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
|
92 %! [X,Y,Z] = sombrero (); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
93 %! [Fx,Fy] = gradient (Z); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
94 %! pcolor (X,Y,Fx+Fy); |
12817
e3e6079039c6
codesprint: 2 demos for pcolor.m dummy for surface.m
Kai Habel <kai.habel@gmx.de>
parents:
11587
diff
changeset
|
95 %! shading interp; |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
96 |