1## Copyright (C) 1998, 1999, 2000  Joao Cardoso
2## Copyright (C) 2004  Rafael Laboissiere
3##
4## This program is free software; you can redistribute it and/or modify it
5## under the terms of the GNU General Public License as published by the
6## Free Software Foundation; either version 2 of the License, or (at your
7## option) any later version.
8##
9## This program is distributed in the hope that it will be useful, but
10## WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12## General Public License for more details.
13##
14## This file is part of plplot_octave.
15## It is based on the corresponding demo function of PLplot.
16
17## Does a simple bar chart, using color fill.  If color fill is
18## unavailable, pattern fill is used instead (automatic).
19
201;
21
22function ix12c
23
24  ## Parse and process command line arguments */
25
26  ## (void) plparseopts(&argc, argv, PL_PARSE_FULL);
27
28  ## Initialize plplot */
29  plinit();
30
31  pladv(0);
32  plvsta();
33  plwind(1980.0, 1990.0, 0.0, 35.0);
34  plbox("bc", 1.0, 0, "bcnv", 10.0, 0);
35  plcol0(2);
36  pllab("Year", "Widget Sales (millions)", "#frPLplot Example 12");
37
38  y0 = [5; 15; 12; 24; 28;30; 20; 8; 12; 3];
39
40  pos = [0.0; 0.25; 0.5; 0.75; 1.0];
41  red = [0.0; 0.25; 0.5; 1.00; 1.0];
42  green = [1.0; 0.50; 0.5; 0.50; 1.0];
43  blue = [1.0; 1.0; 0.5; 0.25; 0.0];
44  rev = [0; 0; 0; 0; 0];
45
46  plscmap1l(1,pos,red,green,blue,rev);
47
48  for i=0:9
49    ##plcol0(i + 1);
50
51    plcol1(i/9.0);
52
53    plpsty(0);
54    plfbox((1980. + i), y0(i+1));
55    string=sprintf("%.0f", y0(i+1));
56    plptex((1980. + i + .5), (y0(i+1) + 1.), 1.0, 0.0, .5, string);
57    string=sprintf("%d", 1980 + i);
58    plmtex("b", 1.0, ((i + 1) * .1 - .05), 0.5, string);
59  endfor
60  plend1();
61endfunction
62
63function plfbox(x0, y0)
64
65  x(1) = x0;
66  y(1) = 0.;
67  x(2) = x0;
68  y(2) = y0;
69  x(3) = x0 + 1.;
70  y(3) = y0;
71  x(4) = x0 + 1.;
72  y(4) = 0.;
73  plfill(x', y');
74  plcol0(1);
75  pllsty(1);
76  plline(x', y');
77
78endfunction
79
80ix12c
81
82