| Search Locate Previous Next | Contents |
The population pyramid is one of the commonest demographic charts, and can be programmed in Rain with two back-to-back horizontal barcharts. The final effect looks like:
This was drawn by the function Population in the RainPro workspace:
RPopulation;MAT;bands
© Illustrate population pyramid (back-to-back horizontal bars)
MAT8 2½21 20,19 19,15 16,14 15,13 14,11 13,9 12,7 10
bands'0-9' '10-19' '20-29' '30-39' '40-49' '50-59' '60-69' '70+'
chSet('STYLE' 'BOXED,hbar,cbar,relative,redraw')('xrange' ¯25 25)
© Make a fat central pillar with a datum line!
chSet('Ystyle' 'atend')('datum' 'solid,ne,broad')
chSet('Vmar' 48 48)('gap' 0.2)('Xdatum' 0)
chSet('HEAD' 'Population of Ruritania')('Ycap' 'Age band')('Xcap' 'Millions')
chSet('ylab'bands)('Key' 'Male' 'Female')
© Set FMT string for labels (kill -ve signs) - new facility at Jan 1998
chSet('qfmt' 'MI6')
© Test this with inside labels too!
chSet('values'bands)('style' 'values') © ('vstyle' 'inside')
chBar MAT[;1]ׯ1 © Go left young man!
chBar MAT[;2] © Females to the right!
PGchClose
R'View PG © to see it'
Some things to note are:
These are all useful tricks to note, and are very typical of the coding style you need when you are developing relatively complex charts which combine several data-sets on the same axes.