R:如何在小时图中调整时间尺度?

时间:2015-10-24 21:54:06

标签: r ggplot2

我想创建一个小时图,唯一的时间信息是UTC时区的小时。但是,我希望情节在AEST时区显示小时刻度。这就是我所做的

Average_value_median <- aggregate(download_speed_normalised_month ~ year+ISP+hour, house_total_filtered, median)
Average_value_median$hour <- as.POSIXct(strptime(Average_value_median$hour, format = "%H"), format = "%y/%m/%d %H:%M:%S", tz= "UTC")


graph_name = paste(Average_value_median$year[1]," Normalised speed by hour plot (median) ")
SpeedHour_Plot <- ggplot(Average_value_median, aes(x = hour, y = download_speed_normalised_month, color = ISP, shape = ISP, color=supp)) +
  geom_point(size=2.5)+
  geom_line(size=1)+
  ylab("Normalised Download speed") +
  scale_x_datetime(breaks = seq(min(Average_value_mean$hour),max(Average_value_mean$hour),"3 hour"),labels = date_format("%H:%M", tz="Australia/Sydney"))+
  scale_y_continuous(limits = c(0, 1), expand = c(0, 0)) +  
  ggtitle(graph_name)+
  theme_bw()

这完全没问题,但我对时间刻度的开始和结束有问题。时间刻度从11:00开始到10:00结束(因为sydney是UTC + 11),但是我希望时间刻度从06:00开始到05:00结束。

有关如何做到这一点的任何想法将不胜感激:)

非常感谢!

This is the current plot I got

0 个答案:

没有答案