Tuesday, 15 July 2014

r - Set ylim with stacked area plot -



r - Set ylim with stacked area plot -

i trying stacked area plot in order compare outcomes under 3 scenarios.

ggplot(firep_all,aes(x = time, y = houses, fill=risk_class, group= risk_class))+ geom_line(aes(ymax=houses), position="stack", colour='darkgrey')+ geom_area(alpha=.75) + scale_fill_brewer(type="seq", palette=18,name = "fire risk class")+facet_grid(~scenario)

although know stacked area plots cumulative, want set ylim, easier see difference between scenarios. preferably ylim(1e7,2.5e7). problem interferes calculations.

ggplot(firep_all,aes(x = time, y = houses, fill=risk_class, group= risk_class))+ geom_line(aes(ymax=houses), position="stack", colour='darkgrey')+ geom_area(alpha=.75) + scale_fill_brewer(type="seq", palette=18,name = "fire risk class")+facet_grid(~scenario) +ylim(1e7,2.5e7)

any thoughts on work around?

to zoom plot should utilize coord_cartesian() ylim= argument.

+ coord_cartesian(ylim=c(1e7,2.5e7))

r plot ggplot2 area stacked-area-chart

No comments:

Post a Comment