Click here to see the SAS code.
Click here to see the example.
---------------------------------------------------------------
Imitation of an example from Chris Ricciardi, for International Monetary Fund (IMF)
The data used in this example is just a rough approximation, based on reading
the values off of another graph, and estimating their numeric values.
---
1st Plot:
I get 2 lines on the same plot, with 2 different scales (left & right)
by using a 'plot' and a 'plot2' in my proc gplot. The plot2 axis is
on the right-hand side.
I color-code the left & right axis labels, so they correspond with
the color of the line that goes with that axis. I specify this color
in the axis statements for the axis label, and in the symbol statements
for the line color.
I also annotate some text at the end of each line, to give another
hint as to which line is which.
The red 'price' line has monthly data, and the 'excess' capacity line
only has one data point per year. for the months where I don't have
an excess capacity number, I use the '.' for a sas missing-value.
I connect the red line points with a simple join, and I connect the
yearly blue data points with a 'step' interpolation (like stair steps).
For the left & right axes, I use "style=0" to make the axis line not
show up.
Since my last data point stops mid-year, I put a dashed refline ther,
so you can see along the bottom axis that the data stops before the
Jan 1 tickmark.
2nd Plot:
For this 2nd plot, it's very tedious estimating data for all the years in
the plot I was copying, so I only did it for the last 4.5 years worth.
There are 2 'tricks' in this one that weren't in the previous one.
I add a blue 'range' area, by adding 2 lines to my plot1 (and 'upper' and
a 'lower'), and I tell gplot that there are 2 'areas' (the first area below
the lower line is white/empty, and the second area which is between the
lower and upper lines is light blue).
The other trick is that I invert/reverse the axis scale on the right side,
so that 0 is at the top (I did this in the axis statement's order= section).
(This is just a sample showing how this type of chart could be done - don't
take these values as actual! :)
Back to Samples Index