Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Population pyramids

218 views
Skip to first unread message

Alex van der Spek

unread,
Apr 19, 2010, 3:48:00 PM4/19/10
to
I can't find how to plot a histogram with horizontal boxes. The script below
does fine for a population pyramid, printing it on paper only requires to
rotate the paper by -90 degrees! It appears as if horizontal boxes are not
possible?
Thanks in advance,
Alex van der Spek
+++++++++++++++++
#! usr/bin/env gnuplot
#Script to plot population pyramid

reset
set term wxt 0 size 640,480 title 'PlotPop.plt'
set datafile separator ','
set size square
set key outside
set style fill transparent solid 0.25
set style data histograms
set style histogram rowstacked gap 5
set key autotitle columnheader
unset border
set xzeroaxis linewidth 2
set yzeroaxis
set xtics rotate by 270 rangelimited
set ytics nomirror rangelimited
set ylabel 'Population [millions]' rotate by 270
#set ytics ("10"10,"5"5,"0"0,"5"-5,"10"-10) rotate by 270
set ytics rotate by 270
plot '$0' using (column(4)/1e6):xtic(2) every ::2 title 'MALE', \
'$0' using (-column(5)/1e6):xtic(2) every ::2 title 'FEMALE'

sfeam

unread,
Apr 19, 2010, 5:47:10 PM4/19/10
to
Alex van der Spek wrote:

> I can't find how to plot a histogram with horizontal boxes. The script
> below does fine for a population pyramid, printing it on paper only
> requires to rotate the paper by -90 degrees! It appears as if horizontal
> boxes are not possible?

That is correct. Horizontal boxes are not possible.
Gnuplot always plots the independent variable on the horizontal and the
dependent variable on the vertical.

Wouter Beck

unread,
Apr 20, 2010, 2:57:44 AM4/20/10
to
Alex van der Spek wrote:

You might want to look at:

http://www.phyast.pitt.edu/~zov1/gnuplot/html/histogram.html#rotated_histogram

Alex van der Spek

unread,
Apr 20, 2010, 5:03:04 AM4/20/10
to
Thanks Ethan and Wouter. Confirms what I thought and had set out to do.

Alex

0 new messages