R 在刻面几何图形线图中标记平均y值ggplot2

R 在刻面几何图形线图中标记平均y值ggplot2,r,ggplot2,R,Ggplot2,我有下面的情节,我正试图 1) 将标签添加到蓝色虚线以显示其值,最好在每个刻面的右侧 2) 按平均值对镶嵌面重新排序,使镶嵌面按平均值的降序显示 require(ggplot2) require(reshape) set.seed(13) df <- data.frame(a=runif(10), b=rnorm(10), c=rbinom(10, 10, 0.

我有下面的情节,我正试图

1) 将标签添加到蓝色虚线以显示其值,最好在每个刻面的右侧

2) 按平均值对镶嵌面重新排序,使镶嵌面按平均值的降序显示

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)
require(ggplot2)
需要(重塑)
种子(13)
df post回答您的第一个问题,问题回答您的第二个问题。(在得出任何结论之前,请务必阅读第二个问题的答案。)发布第一个问题的答案和第二个问题的答案。(在得出任何结论之前,请务必阅读第二个问题的答案。)