I created 25 plots using the ggplots2 library and I'm especially interested in the Geom_Area function. However, I would like to create square plots, with wider x-axis instead of those small rectangle plots stacked next to each other. I used this function to create my 25 variable plots using this code:
fevd_res = fevd(A, Sigma, 20)
p = ggplot(data=fevd_res, aes(x=h, y=value, fill=j)) +
geom_area(position = "fill") +
facet_wrap(k ~ .) +
scale_x_continuous(
expand=c(0,0)
) +
scale_fill_discrete(
name = "Shock"
) +
labs(
y = "Variance contribution",
x = "Forecast horizon"
) +
theme_bw()
Create proportional geom_area plot directly in ggplot2
This problem looks similiar to mine, so I tried adding: position = "fill". This did not work as you see by the output below. Hope someone can help, would mean a lot to me!