John Jaynes
2003-Apr-21 06:01 UTC
[R] Generating axes with "Sun Apr 20 22:45:27 PDT 2003" time coordinates.
Good Morning! My apologies for what may be considered an infantile question: I have data that I would like to plot, positive integers for the y-axis, and time coordinates of the "Sun Apr 20 22:45:27 PDT 2003" format for the x-axis. I have tried: x1 <- 1050352610 x2 <- 1050352999 x3 <- 1050858319 class(x1) <- "POSIXct" class(x2) <- "POSIXct" class(x3) <- "POSIXct" X <- c(x1, x2, x3) ... ... plot(X, Y, type = "l") I end up with "Mon", "Tues", "Wed", ... x-axis coordinates, when I need "2003-04-14 13:36:50 PDT", "2003-04-14 13:43:19 PDT" and "2003-04-20 10:05:19 PDT" x-axis coordinates. I adjusted the data to be one second apart and ended up with integer "19", "20", ... x-axis coordinates. What do I need to do to accomplish this? Any help will be greatly appreciated, as I have looked at the help pages, and the web, to no avail. I would also be more than happy to purchase a book that contains information to this level of detail if that is available. Thank You, John Jaynes
Uwe Ligges
2003-Apr-21 16:09 UTC
[R] Generating axes with "Sun Apr 20 22:45:27 PDT 2003" timecoordinates.
John Jaynes wrote:> > Good Morning! > > My apologies for what may be considered an infantile question: I have data > that I would like to plot, positive integers for the y-axis, and time > coordinates of the "Sun Apr 20 22:45:27 PDT 2003" format for the x-axis. > I have tried: > > x1 <- 1050352610 > x2 <- 1050352999 > x3 <- 1050858319 > class(x1) <- "POSIXct" > class(x2) <- "POSIXct" > class(x3) <- "POSIXct" > X <- c(x1, x2, x3) > ... > ... > plot(X, Y, type = "l") > > I end up with "Mon", "Tues", "Wed", ... x-axis coordinates, when I need > "2003-04-14 13:36:50 PDT", "2003-04-14 13:43:19 PDT" > and "2003-04-20 10:05:19 PDT" x-axis coordinates. I adjusted the data to be > one second apart and ended up with integer "19", "20", ... x-axis > coordinates. What do I need to do to accomplish this? Any help will be > greatly appreciated, as I have looked at the help pages, and the web, to no > avail. I would also be more than happy to purchase a book that contains > information to this level of detail if that is available. > > Thank You, > > John JaynesI guess you are looking for: plot(X, Y, type = "l", xaxt = "n") axis.POSIXct(1, X, at=X, format="%a %b %d %H:%M:%S %Z %Y") Uwe Ligges