Mercurial > hg > octave-lyh
annotate scripts/plot/pie.m @ 14237:11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Add clf() to all demos using plot features to get reproducibility.
Use 64 as input to all colormaps (jet (64)) to get reproducibility.
* bicubic.m, cell2mat.m, celldisp.m, cplxpair.m, interp1.m, interp2.m,
interpft.m, interpn.m, profile.m, profshow.m, convhull.m, delaunay.m,
griddata.m, inpolygon.m, voronoi.m, autumn.m, bone.m, contrast.m, cool.m,
copper.m, flag.m, gmap40.m, gray.m, hot.m, hsv.m, image.m, imshow.m, jet.m,
ocean.m, pink.m, prism.m, rainbow.m, spring.m, summer.m, white.m, winter.m,
condest.m, onenormest.m, axis.m, clabel.m, colorbar.m, comet.m, comet3.m,
compass.m, contour.m, contour3.m, contourf.m, cylinder.m, daspect.m,
ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m,
ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m,
fplot.m, grid.m, hold.m, isosurface.m, legend.m, loglog.m, loglogerr.m,
pareto.m, patch.m, pbaspect.m, pcolor.m, pie.m, pie3.m, plot3.m, plotmatrix.m,
plotyy.m, polar.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m,
rose.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m, semilogy.m,
semilogyerr.m, shading.m, slice.m, sombrero.m, stairs.m, stem.m, stem3.m,
subplot.m, surf.m, surfc.m, surfl.m, surfnorm.m, text.m, title.m, trimesh.m,
triplot.m, trisurf.m, uigetdir.m, uigetfile.m, uimenu.m, uiputfile.m,
waitbar.m, xlim.m, ylim.m, zlim.m, mkpp.m, pchip.m, polyaffine.m, spline.m,
bicgstab.m, cgs.m, gplot.m, pcg.m, pcr.m, treeplot.m, strtok.m, demo.m,
example.m, rundemos.m, speed.m, test.m, calendar.m, datestr.m, datetick.m,
weekday.m: Revamp %!demos to use Octave coding conventions on spacing, etc.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Fri, 20 Jan 2012 12:59:53 -0800 |
parents | 72c96de7a403 |
children | 4506eade9f04 |
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 David Bateman |
7118 | 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 -*- | |
11341
3c7ba1e3dc21
Add missing option slice for pie and pie3
Kai Habel <kai.habel@gmx.de>
parents:
11330
diff
changeset
|
20 ## @deftypefn {Function File} {} pie (@var{x}) |
3c7ba1e3dc21
Add missing option slice for pie and pie3
Kai Habel <kai.habel@gmx.de>
parents:
11330
diff
changeset
|
21 ## @deftypefnx {Function File} {} pie (@var{x}, @var{explode}) |
7118 | 22 ## @deftypefnx {Function File} {} pie (@dots{}, @var{labels}) |
23 ## @deftypefnx {Function File} {} pie (@var{h}, @dots{}); | |
24 ## @deftypefnx {Function File} {@var{h} =} pie (@dots{}); | |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
25 ## Produce a 2-D pie chart. |
7118 | 26 ## |
8325
b93ac0586e4b
spelling corrections
Brian Gough<bjg@network-theory.co.uk>
parents:
7313
diff
changeset
|
27 ## Called with a single vector argument, produces a pie chart of the |
7118 | 28 ## elements in @var{x}, with the size of the slice determined by percentage |
29 ## size of the values of @var{x}. | |
30 ## | |
31 ## The variable @var{explode} is a vector of the same length as @var{x} that | |
32 ## if non zero 'explodes' the slice from the pie chart. | |
33 ## | |
34 ## If given @var{labels} is a cell array of strings of the same length as | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
35 ## @var{x}, giving the labels of each of the slices of the pie chart. |
7118 | 36 ## |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
37 ## The optional return value @var{h} is a list of handles to the patch |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
38 ## and text objects generating the plot. |
7118 | 39 ## |
11330 | 40 ## @seealso{pie3, bar, stem} |
7118 | 41 ## @end deftypefn |
42 | |
43 ## Very roughly based on pie.m from octave-forge whose author was | |
44 ## Daniel Heiserer <Daniel.heiserer@physik.tu-muenchen.de> | |
45 | |
46 function retval = pie (varargin) | |
47 | |
7215 | 48 [h, varargin] = __plt_get_axis_arg__ ("pie", varargin{:}); |
49 | |
7118 | 50 if (nargin < 1) |
51 print_usage (); | |
7215 | 52 else |
7118 | 53 oldh = gca (); |
54 unwind_protect | |
55 axes (h); | |
56 newplot (); | |
11330 | 57 tmp = __pie__ ("pie", h, varargin{:}); |
7118 | 58 unwind_protect_cleanup |
59 axes (oldh); | |
60 end_unwind_protect | |
61 endif | |
62 | |
63 if (nargout > 0) | |
64 retval = tmp; | |
65 endif | |
7119 | 66 |
7118 | 67 endfunction |
68 | |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
69 |
7120 | 70 %!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
|
71 %! clf; |
7120 | 72 %! pie ([3, 2, 1], [0, 0, 1]); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
73 %! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]); |
7120 | 74 |
75 %!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
|
76 %! clf; |
7120 | 77 %! pie ([3, 2, 1], [0, 0, 1], {"Cheddar", "Swiss", "Camembert"}); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
78 %! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]); |
7120 | 79 %! axis ([-2,2,-2,2]); |
11341
3c7ba1e3dc21
Add missing option slice for pie and pie3
Kai Habel <kai.habel@gmx.de>
parents:
11330
diff
changeset
|
80 |
3c7ba1e3dc21
Add missing option slice for pie and pie3
Kai Habel <kai.habel@gmx.de>
parents:
11330
diff
changeset
|
81 %!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
|
82 %! clf; |
11341
3c7ba1e3dc21
Add missing option slice for pie and pie3
Kai Habel <kai.habel@gmx.de>
parents:
11330
diff
changeset
|
83 %! pie ([0.17, 0.34, 0.41], {"Cheddar", "Swiss", "Camembert"}); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
84 %! colormap ([1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1]); |
11341
3c7ba1e3dc21
Add missing option slice for pie and pie3
Kai Habel <kai.habel@gmx.de>
parents:
11330
diff
changeset
|
85 %! axis ([-2,2,-2,2]); |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
86 %! title ("missing slice"); |
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
87 |