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

John Kane jrkrideau at inbox.com
Fri Aug 21 17:31:11 CEST 2015


Would this help on colour?
http://stackoverflow.com/questions/8320462/ggplot2-how-to-adjust-fill-colour-in-a-boxplot-and-change-legend-text

You don't say what you want to with the numbers in scale (what scale?)
You might want to try something like ?scale_manual and then do some googling.

Note almost all the code you provided is redundent for the problem. We probably should have the data however . See ?dput or read ttp://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or  http://adv-r.had.co.nz/Reproducibility.html for some hints on how to frame the question and supply data.



John Kane
Kingston ON Canada


> -----Original Message-----
> From: eladlazar22 at gmail.com
> Sent: Fri, 21 Aug 2015 14:10:23 +0300
> To: r-help at r-project.org
> Subject: [R] fill color in boxplot and change number in scale
> 
> 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()
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!



More information about the R-help mailing list