Skip to content
Prev 167988 / 398502 Next

ggplot seq

Thanks Thierry: 
The use of levels is what I needed, thanks for your help.




 From: ONKELINX, Thierry <Thierry.ONKELINX at inbo.be>
 Subject: RE: [R] ggplot seq
 To: mazatlanmexico at yahoo.com, r-help at stat.math.ethz.ch
 Date: Friday, January 23, 2009, 3:01 AM
 Dear Felipe,
 
 Provide a dummy sample if your dataset is big or
 confidential. The actual values are not that important to figure out what
 kind of plot you want.
 How did you code Week? Numeric? Try convert it into a
 factor with levels = c(27:52, 1:26). And then set the breaks to seq(1, 52, by= 2).
 
 WFBox <- data.frame(Week = rep(1:52, 10), FL = rnorm(520))
 WFBox$fWeek <- factor(WFBox$Week, levels = c(27:52, 1:26))
 library(ggplot2)
 ggplot(WFBox, aes(fWeek, FL)) + geom_boxplot(outlier.colour="pink",outlier.size=3,outlier.shape=21,fill=
 "goldenrod",colour="blue") + scale_x_discrete(breaks=c(seq(1,51,2)))
 
 HTH,
 
 Thierry
 
  ir. Thierry Onkelinx
 Instituut voor natuur- en bosonderzoek / Research Institute
 for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
 methodology and quality assurance
 Gaverstraat 4 9500 Geraardsbergen
 Belgium 
tel. + 32 54/436 185
 Thierry.Onkelinx at inbo.be  www.inbo.be