2

我有一个显示这种关系的箱线图。但是,我无法在绘图上命名变量名称。有谁知道该怎么做?这是R代码:

set.seed(2)
x1 <- sample(rep(1:5,2))
x2 <- sample(rep(1:5,2))
x3 <- sample(rep(1:5,2))
x4 <- sample(rep(1:5,2))
x5 <- sample(rep(1:5,2))
y <- runif(10,-1,1)

d <- data.frame(y,x1,x2,x3,x4,x5)
library(reshape2)
dm <- melt(d,id.var=1)
library(ggplot2)
ggplot(dm,aes(x=value,y=y))+geom_boxplot(aes(group=value))+
facet_wrap(~variable,nrow=1)

在此处输入图像描述

我想写weather and pollution而不是天气。我怎么能那样做?

4

0 回答 0