A cashflow diagram is often used when explaining derivatives in financial engineering. It shows the payoffs at different times. I couldn't find a great example online, but it looks something like this:
I would like to make something roughly equivalent using ggplot2
. My thought was to use a stacked bar plot, where the zero axis is somewhere in the middle. Does anyone know how to do this?
Here's some example data:
data.frame(time=c(1, 2, 3), positive=c(5, 0, 4), negative=c(-2, 0, 0))
Edit:
Thanks to Hadley's answer; the resulting image looks like:
With boxes it looks like: