[R] axis command and excel time format

Robert Baer rbaer at atsu.edu
Thu Nov 9 00:14:22 CET 2006


Carmen,

Gabor has already given you the detail you ask for, but might try the 
following plot to see what is going wrong:

plot(times(tt), x, type='l')

This does not give you the EXACT control of the axis you asked for, but this 
simple plot command gives you a fairly nice result.  It illustrates that 
your code is failing becasue you are plotting x against the index of x 
rather than plotting x against time.  At least this is what I think the 
misunderstanding is.

HTH

> Please provide a complete self contained example.  I can't follow the
> partial code below; however, its likely you are plotting one thing
> and creating axes using another so there is no reason it should
> come out right.
>
> On 11/8/06, Carmen Meier <carmei3 at web.de> wrote:
>> Gabor Grothendieck schrieb:
>> > Your code plots x which has nothing to do with xt.
>> >
>> The same result if you change xt to x: 02:25 at the origin nothing else
>> - I do not know why
>> #---------- your suggestion --------
>>  mn <- times(min_time)
>>  mx <- times(max_time)
>>  n <- 12
>>
>>  t <- times(seq(mn, mx, length = n))
>>
>>  t <- times(unique(sub("..$", "00", t)))
>>
>>  axis(1, x, sub(":00$", "", x)) # works only with plot data before
>>
>>
>>
>> Regards Carmen
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list