我一直在尝试使用ggstructure绘制热图。如果我能得到一些指示,我不介意使用基本图形。我希望热图看起来与此类似:
http://www.vistadatavision.com/uploads/images/reports/intensity_plot_1.PNG
我没有设法进一步输入ggstructure(df3),然后对错误感到头疼 - 这似乎是因为它不喜欢日期/时间数据?
这是两周数据样本的“输入”,间隔为10分钟。 编辑:我最后只有4天的空间。我希望它足够了。
任何指针都非常赞赏。
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")
答案 0 :(得分:10)
我正在使用包lubridate
中的一些魔法将你的日期转换为日期,然后我提取月份和小时:
library(lubridate)
temp$lDate <- with(temp, ymd_hms(paste(date, time)))
temp$month <- month(temp$lDate)
temp$hour <- hour(temp$lDate)
这里的关键是我使用lubridate
函数ymd_hms
将字符格式转换为日期格式。 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
然后直接使用ggplot
绘图:
ggplot(temp, aes(x=hour, y=month)) + geom_tile(aes(fill=speed))