[R] fill color in boxplot and change number in scale

Elad Lazar eladlazar22 at gmail.com
Fri Aug 21 13:10:23 CEST 2015


hello,
I want to change the line color and/or fill of each boxplot and  change
number in scale
what I need to do?


ylim<-c(-3,0.5)
data.for.plot<-data.frame(accelaration=data_2$lag1min_accelaration,
                          lag=1,
                          alert='red')
data.for.plot<-rbind(data.for.plot,
                      data.frame(accelaration=data_2$min_accelaration,
                          lag=0,
                          alert='red'))

data.for.plot<-rbind(data.for.plot,
                      data.frame(accelaration=data_1$lag1min_accelaration,
                          lag=1,
                          alert='yellow'))
data.for.plot<-rbind(data.for.plot,
                     data.frame(accelaration=data_1$min_accelaration,
                                lag=0,
                                alert='yellow'))

data.for.plot<-rbind(data.for.plot,
  data.frame(accelaration=data_0$lag1min_accelaration,
             lag=1,
             alert='no alert'))
data.for.plot<-rbind(data.for.plot,
                     data.frame(accelaration=data_0$min_accelaration,
                                lag=0,
                                alert='no alert'))
library('ggplot2')
ggplot(data.for.plot,aes(fill=factor(alert),
                         y=accelaration,x=factor(lag)))+
  geom_boxplot()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: color.PNG
Type: image/png
Size: 15347 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150821/df2540db/attachment.png>


More information about the R-help mailing list