[R] question on axis labels

Gerard Smits g_smits at verizon.net
Tue Feb 21 01:03:16 CET 2012


Worked like a charm!  Thanks for your help.  Gerard


On Feb 20, 2012, at 3:52 PM, Sarah Goslee wrote:

> This works for me:
> 
>> plot(0:6, runif(7), xaxt="n")
>> axis(1, at=0:6, labels=c("08:00", "12:00", "16:00", "20:00", "24:00", "04:00", "08:00"), cex=0.8)
>> 
> 
> You need the xaxt="n" in the plot statement, and the correct form is at=0:6
> 
> Sarah
> 
> On Mon, Feb 20, 2012 at 6:39 PM, Gerard Smits <g_smits at verizon.net> wrote:
>> Hi All,
>> 
>> I'm trying to label my plot axis with times (HH:MM) that correspond to a numeric index (values 0:6) for my time variable.  I'd like to plot "08:00", "12:00",  and so on, instead of 0 through 6.
>> 
>> I have used the following line of code:
>> 
>> axis(1, 0:6, labels=c("08:00", "12:00", "16:00", "20:00", "24:00", "04:00", "08:00"), cex=0.8)
>> 
>> [I've used both the 0:6 and at=c(0:6), with no effect.]
>> 
>> My labels come out with a 0 - 6, location dependent, superimposed over my colon in my HH:MM string.  So 08:00 looks like 08000, 12:00 looks like 12100.
>> 
>> Any way of suppressing the at locations?
>> 
>> I'm using version 2.14.0 on a mac
>> 
>> My program pulls in the following packages (not sure relevant):
>> 
>> require (Hmisc)
>> require (lattice)
>> require (gplots)
>> 
>> 
>> Thanks for any suggestions,
>> 
>> Gerard
>> 
> 
> -- 
> Sarah Goslee
> http://www.functionaldiversity.org



More information about the R-help mailing list