热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何使用R中的时间序列数据制作热图-HowtomakeaheatmapusingtimeseriesdatainR

Ivebeenattemptingtodrawaheatmapusingggstructure.IdontmindusingbasegraphicsifIcan

I've been attempting to draw a heatmap using ggstructure. I don't mind using base graphics if I can get a few pointers. I want the heatmap to look similar to this:

我一直在尝试使用ggstructure绘制热图。如果我能得到一些指示,我不介意使用基本图形。我希望热图看起来与此类似:

http://www.vistadatavision.com/uploads/images/reports/intensity_plot_1.PNG

http://www.vistadatavision.com/uploads/images/reports/intensity_plot_1.PNG

I haven't managed to get any further than typing ggstructure(df3) and then scratching my head at the error- which seems to be because it doesn't like the date/time data?

我没有设法进一步输入ggstructure(df3),然后在错误中摸不着头脑 - 这似乎是因为它不喜欢日期/时间数据?

Here is the "dput" for a two week sample of the data, with 10 minute intervals. edit: I only had enough room for 4 days worth in the end. I hope it'll suffice.

这是两周数据样本的“输入”,间隔为10分钟。编辑:我最后只有4天的空间。我希望它就够了。

Any pointers much appreciated.

任何指针都非常赞赏。

structure(list(date = c("2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", "2010-01-01", 
"2010-01-01", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", "2010-01-02", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", 
"2010-01-03", "2010-01-03", "2010-01-03", "2010-01-03", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", "2010-01-04", 
"2010-01-04", "2010-01-04", "2010-01-04"), time = c("00:00:00", 
"00:10:00", "00:20:00", "00:30:00", "00:40:00", "00:50:00", "01:00:00", 
"01:10:00", "01:20:00", "01:30:00", "01:40:00", "01:50:00", "02:00:00", 
"02:10:00", "02:20:00", "02:30:00", "02:40:00", "02:50:00", "03:00:00", 
"03:10:00", "03:20:00", "03:30:00", "03:40:00", "03:50:00", "04:00:00", 
"04:10:00", "04:20:00", "04:30:00", "04:40:00", "04:50:00", "05:00:00", 
"05:10:00", "05:20:00", "05:30:00", "05:40:00", "05:50:00", "06:00:00", 
"06:10:00", "06:20:00", "06:30:00", "06:40:00", "06:50:00", "07:00:00", 
"07:10:00", "07:20:00", "07:30:00", "07:40:00", "07:50:00", "08:00:00", 
"08:10:00", "08:20:00", "08:30:00", "08:40:00", "08:50:00", "09:00:00", 
"09:10:00", "09:20:00", "09:30:00", "09:40:00", "09:50:00", "10:00:00", 
"10:10:00", "10:20:00", "10:30:00", "10:40:00", "10:50:00", "11:00:00", 
"11:10:00", "11:20:00", "11:30:00", "11:40:00", "11:50:00", "12:00:00", 
"12:10:00", "12:20:00", "12:30:00", "12:40:00", "12:50:00", "13:00:00", 
"13:10:00", "13:20:00", "13:30:00", "13:40:00", "13:50:00", "14:00:00", 
"14:10:00", "14:20:00", "14:30:00", "14:40:00", "14:50:00", "15:00:00", 
"15:10:00", "15:20:00", "15:30:00", "15:40:00", "15:50:00", "16:00:00", 
"16:10:00", "16:20:00", "16:30:00", "16:40:00", "16:50:00", "17:00:00", 
"17:10:00", "17:20:00", "17:30:00", "17:40:00", "17:50:00", "18:00:00", 
"18:10:00", "18:20:00", "18:30:00", "18:40:00", "18:50:00", "19:00:00", 
"19:10:00", "19:20:00", "19:30:00", "19:40:00", "19:50:00", "20:00:00", 
"20:10:00", "20:20:00", "20:30:00", "20:40:00", "20:50:00", "21:00:00", 
"21:10:00", "21:20:00", "21:30:00", "21:40:00", "21:50:00", "22:00:00", 
"22:10:00", "22:20:00", "22:30:00", "22:40:00", "22:50:00", "23:00:00", 
"23:10:00", "23:20:00", "23:30:00", "23:40:00", "23:50:00", "00:00:00", 
"00:10:00", "00:20:00", "00:30:00", "00:40:00", "00:50:00", "01:00:00", 
"01:10:00", "01:20:00", "01:30:00", "01:40:00", "01:50:00", "02:00:00", 
"02:10:00", "02:20:00", "02:30:00", "02:40:00", "02:50:00", "03:00:00", 
"03:10:00", "03:20:00", "03:30:00", "03:40:00", "03:50:00", "04:00:00", 
"04:10:00", "04:20:00", "04:30:00", "04:40:00", "04:50:00", "05:00:00", 
"05:10:00", "05:20:00", "05:30:00", "05:40:00", "05:50:00", "06:00:00", 
"06:10:00", "06:20:00", "06:30:00", "06:40:00", "06:50:00", "07:00:00", 
"07:10:00", "07:20:00", "07:30:00", "07:40:00", "07:50:00", "08:00:00", 
"08:10:00", "08:20:00", "08:30:00", "08:40:00", "08:50:00", "09:00:00", 
"09:10:00", "09:20:00", "09:30:00", "09:40:00", "09:50:00", "10:00:00", 
"10:10:00", "10:20:00", "10:30:00", "10:40:00", "10:50:00", "11:00:00", 
"11:10:00", "11:20:00", "11:30:00", "11:40:00", "11:50:00", "12:00:00", 
"12:10:00", "12:20:00", "12:30:00", "12:40:00", "12:50:00", "13:00:00", 
"13:10:00", "13:20:00", "13:30:00", "13:40:00", "13:50:00", "14:00:00", 
"14:10:00", "14:20:00", "14:30:00", "14:40:00", "14:50:00", "15:00:00", 
"15:10:00", "15:20:00", "15:30:00", "15:40:00", "15:50:00", "16:00:00", 
"16:10:00", "16:20:00", "16:30:00", "16:40:00", "16:50:00", "17:00:00", 
"17:10:00", "17:20:00", "17:30:00", "17:40:00", "17:50:00", "18:00:00", 
"18:10:00", "18:20:00", "18:30:00", "18:40:00", "18:50:00", "19:00:00", 
"19:10:00", "19:20:00", "19:30:00", "19:40:00", "19:50:00", "20:00:00", 
"20:10:00", "20:20:00", "20:30:00", "20:40:00", "20:50:00", "21:00:00", 
"21:10:00", "21:20:00", "21:30:00", "21:40:00", "21:50:00", "22:00:00", 
"22:10:00", "22:20:00", "22:30:00", "22:40:00", "22:50:00", "23:00:00", 
"23:10:00", "23:20:00", "23:30:00", "23:40:00", "23:50:00", "00:00:00", 
"00:10:00", "00:20:00", "00:30:00", "00:40:00", "00:50:00", "01:00:00", 
"01:10:00", "01:20:00", "01:30:00", "01:40:00", "01:50:00", "02:00:00", 
"02:10:00", "02:20:00", "02:30:00", "02:40:00", "02:50:00", "03:00:00", 
"03:10:00", "03:20:00", "03:30:00", "03:40:00", "03:50:00", "04:00:00", 
"04:10:00", "04:20:00", "04:30:00", "04:40:00", "04:50:00", "05:00:00", 
"05:10:00", "05:20:00", "05:30:00", "05:40:00", "05:50:00", "06:00:00", 
"06:10:00", "06:20:00", "06:30:00", "06:40:00", "06:50:00", "07:00:00", 
"07:10:00", "07:20:00", "07:30:00", "07:40:00", "07:50:00", "08:00:00", 
"08:10:00", "08:20:00", "08:30:00", "08:40:00", "08:50:00", "09:00:00", 
"09:10:00", "09:20:00", "09:30:00", "09:40:00", "09:50:00", "10:00:00", 
"10:10:00", "10:20:00", "10:30:00", "10:40:00", "10:50:00", "11:00:00", 
"11:10:00", "11:20:00", "11:30:00", "11:40:00", "11:50:00", "12:00:00", 
"12:10:00", "12:20:00", "12:30:00", "12:40:00", "12:50:00", "13:00:00", 
"13:10:00", "13:20:00", "13:30:00", "13:40:00", "13:50:00", "14:00:00", 
"14:10:00", "14:20:00", "14:30:00", "14:40:00", "14:50:00", "15:00:00", 
"15:10:00", "15:20:00", "15:30:00", "15:40:00", "15:50:00", "16:00:00", 
"16:10:00", "16:20:00", "16:30:00", "16:40:00", "16:50:00", "17:00:00", 
"17:10:00", "17:20:00", "17:30:00", "17:40:00", "17:50:00", "18:00:00", 
"18:10:00", "18:20:00", "18:30:00", "18:40:00", "18:50:00", "19:00:00", 
"19:10:00", "19:20:00", "19:30:00", "19:40:00", "19:50:00", "20:00:00", 
"20:10:00", "20:20:00", "20:30:00", "20:40:00", "20:50:00", "21:00:00", 
"21:10:00", "21:20:00", "21:30:00", "21:40:00", "21:50:00", "22:00:00", 
"22:10:00", "22:20:00", "22:30:00", "22:40:00", "22:50:00", "23:00:00", 
"23:10:00", "23:20:00", "23:30:00", "23:40:00", "23:50:00", "00:00:00", 
"00:10:00", "00:20:00", "00:30:00", "00:40:00", "00:50:00", "01:00:00", 
"01:10:00", "01:20:00", "01:30:00", "01:40:00", "01:50:00", "02:00:00", 
"02:10:00", "02:20:00", "02:30:00", "02:40:00", "02:50:00", "03:00:00", 
"03:10:00", "03:20:00", "03:30:00", "03:40:00", "03:50:00", "04:00:00", 
"04:10:00", "04:20:00", "04:30:00", "04:40:00", "04:50:00", "05:00:00", 
"05:10:00", "05:20:00", "05:30:00", "05:40:00", "05:50:00", "06:00:00", 
"06:10:00", "06:20:00", "06:30:00", "06:40:00", "06:50:00", "07:00:00", 
"07:10:00", "07:20:00", "07:30:00", "07:40:00", "07:50:00", "08:00:00", 
"08:10:00", "08:20:00", "08:30:00", "08:40:00", "08:50:00", "09:00:00", 
"09:10:00", "09:20:00", "09:30:00", "09:40:00", "09:50:00", "10:00:00", 
"10:10:00", "10:20:00", "10:30:00", "10:40:00", "10:50:00", "11:00:00", 
"11:10:00", "11:20:00", "11:30:00", "11:40:00", "11:50:00", "12:00:00", 
"12:10:00", "12:20:00", "12:30:00", "12:40:00", "12:50:00", "13:00:00", 
"13:10:00", "13:20:00", "13:30:00", "13:40:00", "13:50:00", "14:00:00", 
"14:10:00", "14:20:00", "14:30:00", "14:40:00", "14:50:00", "15:00:00", 
"15:10:00", "15:20:00", "15:30:00", "15:40:00", "15:50:00", "16:00:00", 
"16:10:00", "16:20:00", "16:30:00", "16:40:00", "16:50:00", "17:00:00", 
"17:10:00", "17:20:00", "17:30:00", "17:40:00", "17:50:00", "18:00:00", 
"18:10:00", "18:20:00", "18:30:00", "18:40:00", "18:50:00", "19:00:00", 
"19:10:00", "19:20:00", "19:30:00", "19:40:00", "19:50:00", "20:00:00", 
"20:10:00", "20:20:00", "20:30:00", "20:40:00", "20:50:00", "21:00:00", 
"21:10:00", "21:20:00", "21:30:00", "21:40:00", "21:50:00", "22:00:00", 
"22:10:00", "22:20:00", "22:30:00", "22:40:00", "22:50:00", "23:00:00", 
"23:10:00", "23:20:00", "23:30:00", "23:40:00", "23:50:00"), 
    speed = c(7.352, 8.75, 8.67, 9.87, 10.22, 8.39, 9.68, 10.12, 
    10.72, 10.28, 10.64, 11.69, 10.9, 10.75, 11.02, 11.4, 10.62, 
    10.69, 10.21, 8.59, 6.096, 5.073, 5.251, 5.16, 8.1, 7.379, 
    7.427, 6.332, 2.823, 1.775, 1.842, 3.529, 4.872, 3.66, 3.682, 
    5.894, 6.326, 3.891, 1.168, 1.788, 2.519, 3.232, 2.906, 1.764, 
    1.758, 1.416, 1.131, 1.033, 0.687, 0.777, 0.965, 1.363, 2.57, 
    1.799, 2.578, 2.125, 1.47, 1.666, 2.218, 1.686, 2.55, 2.898, 
    2.543, 2.666, 3.841, 3.354, 3.992, 4.54, 5.006, 3.97, 3.228, 
    3.632, 4.018, 4.454, 4.227, 4.197, 4.932, 5.168, 4.73, 3.995, 
    3.294, 3.878, 4.003, 3.526, 3.002, 2.497, 4.412, 5.954, 5.562, 
    6.875, 7.241, 7.742, 8.52, 8.74, 7.561, 7.834, 6.459, 7.42, 
    7.179, 6.295, 7.011, 5.869, 4.515, 4.607, 6.166, 7.154, 6.807, 
    5.857, 5.961, 7.113, 7.898, 9.16, 8.41, 7.685, 7.527, 8.15, 
    8.55, 7.041, 6.587, 6.939, 6.258, 6.191, 6.683, 6.307, 5.09, 
    6.277, 5.108, 5.042, 4.64, 5.574, 6.464, 7.597, 7.258, 6.839, 
    5.161, 3.324, 1.914, 1.522, 2.061, 2.713, 3.443, 2.732, 2.979, 
    2.104, 1.736, 1.853, 1.74, 2.016, 1.791, 2.203, 2.821, 2.425, 
    2.399, 2.597, 2.289, 2.645, 2.184, 2.505, 2.781, 2.864, 3.935, 
    2.769, 2.94, 3.557, 3.28, 3.122, 3.355, 3.728, 3.118, 2.921, 
    2.965, 3.024, 3.289, 3.111, 2.529, 2.535, 2.397, 2.889, 3.574, 
    4.434, 3.751, 3.258, 2.863, 3.47, 4.324, 5.22, 5.047, 4.921, 
    5.597, 5.525, 3.962, 2.7, 3.025, 2.979, 3.073, 2.775, 2.757, 
    1.844, 1.798, 1.851, 1.439, 0.597, 0.596, 0.66, 0.58, 0.514, 
    0.869, 0.791, 1.06, 1.819, 2.369, 3.203, 4.042, 4.934, 4.943, 
    5.724, 5.968, 5.93, 5.479, 5.226, 4.496, 4.542, 4.461, 4.771, 
    5.714, 6.123, 6.001, 6.006, 8.5, 8.08, 8.66, 13.68, 15.05, 
    14.81, 15.18, 13.17, 13.99, 11.76, 10.79, 10.55, 12.15, 10.13, 
    9.33, 11.74, 10.65, 11.86, 11.81, 11.49, 10.63, 9.98, 11.04, 
    13.4, 13.52, 13.34, 12.92, 13.82, 12.97, 13.96, 13.85, 14.66, 
    14.22, 13.58, 11.11, 8.82, 6.344, 6.193, 7.558, 5.88, 4.859, 
    3.641, 7.128, 7.181, 5.916, 6.483, 7.122, 7.916, 7.988, 6.27, 
    6.147, 5.893, 3.871, 1.814, 3.068, 2.848, 3.33, 4.57, 4.992, 
    5.646, 6.891, 6.874, 7.557, 7.205, 6.667, 7.256, 7.823, 5.344, 
    4.191, 5.664, 4.366, 5.47, 3.042, 2.471, 4.105, 6.318, 6.816, 
    6.29, 6.228, 6.73, 4.319, 3.992, 4.582, 4.964, 3.375, 2.778, 
    6.124, 7.872, 8.03, 7.017, 6.786, 7.192, 6.997, 6.905, 6.919, 
    8.1, 7.055, 5.627, 4.639, 4.944, 4.854, 5.301, 6.424, 6.429, 
    5.886, 5.251, 6.451, 7.019, 7.274, 7.373, 6.766, 6.637, 6.027, 
    6.151, 7.192, 5.65, 5.464, 6.259, 6.118, 5.307, 4.718, 5.125, 
    5.094, 4.735, 4.17, 5.146, 5.873, 6.181, 6.053, 5.443, 5.027, 
    4.569, 4.647, 4.297, 5.238, 4.756, 3.765, 3.545, 2.681, 2.241, 
    2.053, 0.887, 3.322, 2.535, 1.534, 1.595, 2.099, 2.74, 4.167, 
    4.15, 4.266, 4.214, 4.701, 3.881, 3.486, 3.302, 3.745, 3.291, 
    5.713, 4.915, 5.247, 4.359, 3.976, 3.8, 4.169, 4.42, 5.112, 
    5.347, 4.502, 4.312, 4.398, 4.318, 4.291, 4.082, 3.669, 3.267, 
    3.274, 3.23, 2.821, 2.909, 3.102, 3.53, 3.273, 3.425, 4.016, 
    4.109, 3.773, 4.048, 3.641, 3.3, 3.726, 3.424, 3.417, 3.842, 
    4.292, 5.163, 4.391, 4.214, 4.136, 4.017, 3.645, 3.153, 2.741, 
    3.095, 3.454, 4.326, 4.716, 5.266, 4.746, 3.758, 3.301, 3.149, 
    4.088, 4.496, 4.247, 4.917, 4.657, 4.424, 4.762, 5.31, 5.014, 
    4.219, 3.923, 3.038, 2.891, 2.868, 2.908, 2.659, 2.235, 1.655, 
    1.459, 1.539, 1.552, 2.037, 1.836, 1.14, 1.004, 0.588, 0.364, 
    0.4, 0.475, 1.201, 1.045, 0.803, 0.903, 0.577, 0.869, 0.709, 
    0.864, 0.33, 0.28, 0.611, 0.859, 0.589, 0.462, 0.54, 0.432, 
    0.989, 1.3, 1.039, 1.05, 1.523, 0.762, 1.022, 0.711, 0.6, 
    0.627, 0.747, 0.518, 0.265, 0.895, 1.271, 1.794, 1.669, 1.456, 
    1.311, 1.345, 1.721, 1.72, 1.854, 1.339, 1.297, 1.261, 1.283, 
    1.107, 1.08, 1.545, 0.97, 1.054, 0.926, 0.731, 0.437, 0.559, 
    1.624, 2.216, 2.198, 2.18, 1.626, 1.697, 1.732, 1.609, 1.98, 
    1.322, 0.592, 0.497, 0.515, 0.652, 0.839, 1.167, 1.025, 1.034, 
    1.078, 0.847, 0.785, 0.923, 1.142, 0.506, 0.605, 1.377, 2.704, 
    3.311, 2.794, 2.885, 3.576, 4.438, 4.212, 3.759, 2.983, 2.761, 
    2.254, 2.612, 2.286, 1.717, 2.007, 1.989, 2.165, 2.477, 3.867, 
    4.573, 4.254, 4.298, 3.852, 3.635, 2.544, 2.862, 2.063, 1.231, 
    0.936)), .Names = c("date", "time", "speed"), row.names = c(NA, 
576L), class = "data.frame")

1 个解决方案

#1


10  

I am using some of the magic in package lubridate to convert your date to Date, and then I extract the month and hour:

我正在使用包lubridate中的一些魔法将你的日期转换为Date,然后我提取月和小时:

library(lubridate)

temp$lDate <- with(temp, ymd_hms(paste(date, time)))
temp$month <- month(temp$lDate)
temp$hour  <- hour(temp$lDate)

The key here is that I used the lubridate function ymd_hms to convert from character format into Date format. lubridate provides a range of convenience functions that makes conversions of different date format very easy, e.g. ymd, mdy, etc.

这里的关键是我使用了lubridate函数ymd_hms将字符格式转换为Date格式。 lubridate提供了一系列便利功能,可以很容易地转换不同的日期格式,例如ymd,mdy等

head(temp)

        date     time  speed               lDate month hour
1 2010-01-01 00:00:00  7.352 2010-01-01 00:00:00     1    0
2 2010-01-01 00:10:00  8.750 2010-01-01 00:10:00     1    0
3 2010-01-01 00:20:00  8.670 2010-01-01 00:20:00     1    0
4 2010-01-01 00:30:00  9.870 2010-01-01 00:30:00     1    0
5 2010-01-01 00:40:00 10.220 2010-01-01 00:40:00     1    0
6 2010-01-01 00:50:00  8.390 2010-01-01 00:50:00     1    0

Then it's straight-forward to plot using ggplot:

然后直接使用ggplot进行绘图:

ggplot(temp, aes(x=hour, y=month)) + geom_tile(aes(fill=speed))

enter image description here


推荐阅读
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • 原文转自:http:blog.csdn.netchinasoftosgarticledetails7903045UploadAction.java:packagecr ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • Python正则表达式学习记录及常用方法
    本文记录了学习Python正则表达式的过程,介绍了re模块的常用方法re.search,并解释了rawstring的作用。正则表达式是一种方便检查字符串匹配模式的工具,通过本文的学习可以掌握Python中使用正则表达式的基本方法。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • FeatureRequestIsyourfeaturerequestrelatedtoaproblem?Please ... [详细]
  • 成功安装Sabayon Linux在thinkpad X60上的经验分享
    本文分享了作者在国庆期间在thinkpad X60上成功安装Sabayon Linux的经验。通过修改CHOST和执行emerge命令,作者顺利完成了安装过程。Sabayon Linux是一个基于Gentoo Linux的发行版,可以将电脑快速转变为一个功能强大的系统。除了作为一个live DVD使用外,Sabayon Linux还可以被安装在硬盘上,方便用户使用。 ... [详细]
  • 本文介绍了南邮ctf-web的writeup,包括签到题和md5 collision。在CTF比赛和渗透测试中,可以通过查看源代码、代码注释、页面隐藏元素、超链接和HTTP响应头部来寻找flag或提示信息。利用PHP弱类型,可以发现md5('QNKCDZO')='0e830400451993494058024219903391'和md5('240610708')='0e462097431906509019562988736854'。 ... [详细]
  • 本文介绍了Android 7的学习笔记总结,包括最新的移动架构视频、大厂安卓面试真题和项目实战源码讲义。同时还分享了开源的完整内容,并提醒读者在使用FileProvider适配时要注意不同模块的AndroidManfiest.xml中配置的xml文件名必须不同,否则会出现问题。 ... [详细]
  • Android开发实现的计时器功能示例
    本文分享了Android开发实现的计时器功能示例,包括效果图、布局和按钮的使用。通过使用Chronometer控件,可以实现计时器功能。该示例适用于Android平台,供开发者参考。 ... [详细]
  • 本文讨论了在openwrt-17.01版本中,mt7628设备上初始化启动时eth0的mac地址总是随机生成的问题。每次随机生成的eth0的mac地址都会写到/sys/class/net/eth0/address目录下,而openwrt-17.01原版的SDK会根据随机生成的eth0的mac地址再生成eth0.1、eth0.2等,生成后的mac地址会保存在/etc/config/network下。 ... [详细]
  • Ihaveapolynomial(generatedfromthecharacteristicpolynomialofamatrix)andIdliketosolve ... [详细]
author-avatar
深圳陶笛_512
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有