I have the following data set:
Year, Height, Width, Weight
1990, 5, 45, 190
2000, 7, 77, 210
2010, 2, 20, 150
I would like to plot a single column of bar charts with a plot for height, width, and weight. In each bar chart, the values would be plotted for each year. So, say the top bar plot in my column of bar charts is height it would show the values 5, 7, and 2 with the years 1990, 2000, and 2010 on the x-axis.
I have figured out how to have a single column of bar plots with each bar plot representing a year:
data <- read.csv("../data/MyData.csv")
data.m <- melt(data, id.vars = "Year")
p <- ggplot(data.m, aes(variable, value)) + geom_bar(stat="identity") + facet_wrap(~ Year, ncol=1)
print(p)
In this case, my variables – height, weight, and width – are on the x-axis of each bar plot. Nevertheless, I simply cannot get my head around how to do convert this so that Year is on the x-axis. Any suggestions?