how do I have multiple barplots in one graph?
I would like to produce a graph that has stacked bars of the Area stacking the Season (summer and Winter) by HR (60 and 90) by year. Basically开发者_开发知识库 along the X axis I want my two HR sizes (60 &90) to be side by side, but grouped by year (2003, 2004, 2005 etc). And then the Areas for the 2 seasons are stacked on top of each other.
Year Season HR Area
2003 summer 60 13419.50953
2004 summer 60 13825.55977
2005 summer 60 13628.62486
2006 summer 60 13098.44875
2003 summer 90 25836.8865
2004 summer 90 29908.79986
2005 summer 90 31709.97851
2006 summer 90 27996.521
2003 Winter 60 5622.281258
2004 Winter 60 9270.272772
2005 Winter 60 11299.37334
2006 Winter 60 15359.69352
2003 Winter 90 14500.94848
2004 Winter 90 27264.27162
2005 Winter 90 26040.42253
2006 Winter 90 38532.49895
Is this what you had in mind?
library(ggplot2)
ggplot(dat, aes(x=Year, y=Area, fill=Season)) +
geom_bar(stat="identity") +
facet_wrap(~HR)
精彩评论