0

I need to create 16 bar plots in one figure (facet or split screen)for scientific paper from a data.frame with 17 numeric columns, and use the argument split to separate the bars by Month. I have a large data.frame for 16 evaporation methods with average monthly values. I try to do it by faceting and split screen but I could not.I have attached the image of data.I hope find solution.Best regards

ahmed2015
  • 3
  • 2
  • 4
    Welcome to SO! Please show the code you have used with (a sample of) your data, aka a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – RHA Oct 11 '15 at 20:07

1 Answers1

0

Have a look at how to reshape your data from wide to long format. Then you can use ggplot:

# create sample data
df <-  cbind(Month = 1:12, as.data.frame(replicate(16, runif(12))))

# reshape it from wide to long format
df <- reshape(df, idvar = 1, varying = list(-1), times = names(df)[-1], direction = "long", sep = "", timevar = "key", v.names = "value")

# Facetted bar plot
library(ggplot2)
ggplot(df, aes(x = Month, y = value)) + 
  geom_bar(stat = "identity") + 
  facet_wrap(~key)
lukeA
  • 53,097
  • 5
  • 97
  • 100