简体   繁体   中英

Plotting hourly data

I am trying to plot a series hourly using this simple data by converting .csv data into an xts object by using these commands. It is successfully converted into a xts object but when I plot it, because there are 2 values on 31.08.2010, only one of them is shown on that day. How can I make a hourly plot instead of daily by using plot command?

Data <- structure(list(DATE = c("17.08.2010 17:00", "24.08.2010 11:00",
  "31.08.2010 16:00", "31.08.2010 17:00"), Return = c(0.00025, -0.007498,
  -0.009066, 0.000889)), .Names = c("DATE", "Return"), class = "data.frame",
  row.names = c(NA, -4L))
myxts <- xts(Data$Return, as.POSIXct(Data$DATE, format="%d.%m.%Y %H:%M"))
plot(myxts)

Both points on 31.08.2010 are shown. It's just hard to see on the line plot because they're only 1 hour apart, and the other points are >24 hours apart. You can see they're both there if you use type="p" .

plot(myxts, type="p")

xts类型为“ p”的图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM