I have the following data:
head(MP_rates_dateformat)
Month repo revrepo bankrate CRR Callrate WPI GDP FED
1 2001-04-01 9.00 6.75 7 8.0 7.
Here is a solution based on the idea of melting/gathering the data, using fill
in ggplot
combined with position = "identity"
. Note that the order of the columns is important as the smallest value revrepo
should be plot after the first one repo
.
library("tidyr")
df_gather <- gather(select(MP_rates_dateformat, 1:3), variable, value, -Month)
library("ggplot2")
ggplot(data = df_gather, aes(x = Month)) +
geom_area(aes(y = value, fill = variable), position = "identity")