[R] x-axis labelling
David Winsemius
dwinsemius at comcast.net
Mon Feb 4 18:15:12 CET 2013
On Feb 4, 2013, at 4:00 AM, Alfredo Tello wrote:
> Hi Dave,
>
> Thanks for your reply. I can't reproduce the last line of code your code. The ifelse argument throws back an error saying it was not used.
Did you look at your graphics window? On my machine the plot you asked for was created by the preceding line:
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)
True, the line in question was copied to the message by mistake, but an arguably workable answer was presented.
--
David.
>
> A
>
>
> On Fri, Feb 1, 2013 at 10:56 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> 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
>
>
>
>
> --
> Alfredo Tello (http://alfredotello.com)
> Sustainable Aquaculture Group
> Institute of Aquaculture
> University of Stirling
> Scotland, UK.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list