Thank you for helping me!
I try the "pretty" funtion to select the x-axis position value.Then I use the "format" 
funtion.

xax.pos <- pretty(as.numeric(x$x.name))
format(xax.pos,'%d %b %y')
> xax.pos
[1] 1091600000 1091800000 1092000000 1092200000 1092400000 1092600000 1092800000
[8] 1093000000

There are something wrong. I found the xax.pos has been changed to the number of 
second calculated since 1970 ,such as 1091600000.
So this problem was not solved. 

 

Best Regards!
Ivy Liïæçï
YMS in Production & Testing
Semiconductor Manufactory International(ShangHai) Corporation
#18 ZhangJiang Road, PuDong New Area, Shanghai, China
Tel: 021-5080-2000 *11754
Email: [EMAIL PROTECTED]



-----ååéä-----
åää: Marc Mamin [mailto:[EMAIL PROTECTED]
åéæé: 2004å10æ18æ 15:03
æää: Ivy_Li; [EMAIL PROTECTED]
äé: Re: [R] How to draw x-axis time label.


Hello Ivy,
Your scale shows times in seconds since 1970 (I guess it is 1970)

usually, I don't draw the axis with plot (see xaxt="n"), but call axis 
aftewards, giving the ticks positions and the labels as strings, using 
format.

With your example:

format(Time,'%d %b %Y')
  [1] "05 Aug 2004" "13 Aug 2004" "14 Aug 2004" "12 Aug 2004" "12 Aug 2004"
  [6] "11 Aug 2004" "12 Aug 2004" "18 Aug 2004" "13 Aug 2004" "14 Aug 2004"

Cheers,

Marc


On Mon, 18 Oct 2004 14:26:51 +0800, Ivy_Li <[EMAIL PROTECTED]> wrote:

> Hi everybody,
>       Could I consult one problem?
>       It is about plot
>       Now I do some analysis in plot . I need to draw a plot which x-axis is 
> time . But when I run the funtion of plot . The x-label are very oddness 
> number, such as the time is "2004-08-05 09:08:48", but the x-label is 
> 1091800000. I don't know how to do .
>       I have an example . Mybe It  can explain my meaning clearly.
>       Thank you for helping me!
>
> Time <- c("2004-08-05 09:08:48", "2004-08-13 20:53:38",
>       "2004-08-14 13:57:23", "2004-08-12 16:17:41",
>       "2004-08-12 16:15:27", "2004-08-11 21:38:24",
>       "2004-08-12 14:28:41", "2004-08-18 18:04:47",
>       "2004-08-13 15:23:14", "2004-08-14 02:36:33")
> Time <- as.POSIXlt(Time)
> x <- data.frame(main.name="AAA", 
> fruit.name=rep(c("Apply","Watermelon"),each=5),
>               x.name=Time, y.name=(1:10))
> plot(as.numeric(x$x.name),as.character(x$y.name),pch=26,)
> fruit.class <- table(x$fruit.name)
> color.code <- 
> c(611,552,656,121,451,481,28,652,32,550,90,401,150,12,520,8)
> for(j in 1:length(fruit.class))
> {
>       fruit <- names(fruit.class)[j]
>       lines(smooth.spline(x[x$fruit.name==fruit, "x.name"],
>               x[x$fruit.name==fruit, "y.name"],df=5),
>               col=colors()[color.code[j]],lwd=5)
> }
>
> Best Regards!
> Ivy LiÄïÄËÃâÃÂÃÂÄâËÄïÄÂ
> YMS in Production & Testing
> Semiconductor Manufactory International(ShangHai) Corporation
> #18 ZhangJiang Road, PuDong New Area, Shanghai, China
> Tel: 021-5080-2000 *11754
> Email: [EMAIL PROTECTED]
>
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to