[R] add text to a plot, create character labels

David Winsemius dwinsemius at comcast.net
Wed Aug 1 19:38:22 CEST 2012


On Aug 1, 2012, at 9:04 AM, Yolande Tra wrote:

> Hi,
>
> I was trying to run the following, where the labels on the x axis  
> are dates
> and need to be converted to characters. It did not work. Any help  
> would be
> appreciated. Thanks.
>
>>
> text(axTicks(1),par("usr)[3]

There is an unmatched quote in the par() call. Adding spaces after  
commas in argument lists may help you see these sorts of errors in the  
future.


> -2 
> ,srt 
> = 
> 45 
> ,adj 
> = 
> 1 
> ,labels 
> =as.character(c("2008-01-08","2008-08-10","2008-08-22","2008-09-03",
> "2008-09-15")), xpd=T, cex=0.8)
> Error: unexpected numeric constant in
> "text(axTicks(1),par("usr) 
> [3]-2,srt=45,adj=1,labels=as.character(c("2008"
> Yolande
>
>
-- 

David Winsemius, MD
Alameda, CA, USA



More information about the R-help mailing list