Skip to content

question on axis labels

3 messages · Sarah Goslee, Gerard Smits

#
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
#
This works for me:
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:

  
    
#
Worked like a charm!  Thanks for your help.  Gerard
On Feb 20, 2012, at 3:52 PM, Sarah Goslee wrote: