2

I have the following plot, and I'm trying to

1) add labels to the dashed blue lines to show their value, preferably on the right side of each facet

2) reorder the facets by the mean, so that the facets appear in descending order of mean

require(ggplot2)
require(reshape)
set.seed(13)                                                                 
df <- data.frame(a=runif(10), b=rnorm(10), c=rbinom(10, 10, 0.1),            
             d=runif(10, -1, 1), date=as.Date("2000-01-01") + 0:9)       
df <- melt(df, id=c('date'))                                                 

g <- ggplot(df, aes(date, value)) + geom_line() + facet_wrap(~variable)      
g <- g + geom_line(stat='hline', yintercept='mean', color='blue', linetype=2)

enter image description here

Idr
  • 6,000
  • 6
  • 34
  • 49
  • 3
    [This](http://stackoverflow.com/q/5490638/324364) post answers your first question and [this](http://stackoverflow.com/q/11023129/324364) question answers your second question. (Be sure to read the answer to the second question before you jump to any conclusions.) – joran Jul 06 '12 at 20:21

0 Answers0