[R] x-axis labelling

David Winsemius dwinsemius at comcast.net
Sat Feb 2 02:56:46 CET 2013


On Feb 1, 2013, at 9:30 AM, Alfredo Tello wrote:

> Hi Folks!
>
> I have a question regarding an issue on which I´ve read a few  
> threads but
> can´t resolve --> Labelling every other tick mark on the x-axis using
> factors. Here´s an example:
>
Why not:

db<-data.frame(date=as.factor(c(1:50)),var=rnorm(50))
barplot(db$var,names.arg=ifelse( rep( c(TRUE,FALSE),  
length=length(levels(db$date) ) ),  levels(db$date),  
""),las=2,cex.axis=0.8,cex=0.8)

barplot(db$var,names.arg=ifelse( c(TRUE,FALSE),  levels(db$date),  
""},las=2,cex.axis=0.8,cex=0.8)


-- David.
> This labels all the tickmarks in my barplot, which is the default  
> behavior.
> I would like to label every other tick mark in the barplot -->
> 1,3,5,7 and so on.
>
> Thank you very much for your help!
>
>
> All the best,
>
> A
>
> -- 
> Alfredo Tello (http://alfredotello.com)
> Sustainable Aquaculture Group
> Institute of Aquaculture
> University of Stirling
> Scotland, UK.
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

David Winsemius, MD
Alameda, CA, USA



More information about the R-help mailing list