Re: presentation graphics
Russell Coker wrote:
> I want to produce some simple bar charts showing the difference between
> different products. Gnuplot doesn't seem to be able to do what I want (just
> nice clean bars with numbers at the tops and descriptions at the bottom).
Ok, here's my shoot at it using `gri'
http://www.debian.org/Packages/unstable/math/gri.html
http://www.phys.ocean.dal.ca/~kelley/gri/
(See http://www.debian.org/~psg for a pointer to a slink version)
Note that gri, like gnuplot I assume, doesn't have the concept of a
bar chart. Yet you can easily program it to do what you want (and
further customize fonts, line widths, colours, etc)
Assume the two data files:
--- bar.dat ---
15
13.5
18
5
10.2
--- bar.dat ---
--- bar.labels ---
widget
bidget
squidget
midget
didget
--- bar.labels ---
Run the following bar.gri file like so:
$ gri bar.gri
to produce bar.ps
--- bar.gri ---
set x margin 5
set y margin 8
set x axis 0 10
set y axis 0 20
set x size 10
set y size 15
.xLeft. = 1
.toggle. = 0
open bar.dat
open bar.labels
while 1
read from bar.labels
read \label
if ..eof..
break
end if
read from bar.dat
read .val.
set color hsb {rpn .xLeft. 1 - 6 /} 1 1
draw box filled .xLeft. 0 {rpn .xLeft. .9 +} .val.
set color black
draw box .xLeft. 0 {rpn .xLeft. .9 +} .val.
sprintf \.val. "%.1lf" .val.
draw label "\.val." centered at \
{rpn .xLeft. .45 + xusertocm} \
{rpn .val. yusertocm .2 +} cm
if .toggle.
draw label "\label" centered at \
{rpn .xLeft. .45 + xusertocm} \
{rpn ..ymargin.. .7 -} cm
.toggle. = 0
else
draw label "\label" centered at \
{rpn .xLeft. .45 + xusertocm} \
{rpn ..ymargin.. 1.2 -} cm
.toggle. = 1
end if
.xLeft. += 1
end while
--- bar.gri ---
Peter Galbraith, the Debian maintainer for gri.
Reply to: