I want to plot the wind over a very long time,thus a dynamic plot is a nice choice for others to choose the time range. And I want to display the wind direction as arrows; wind speed could be line.
But it will be messy if I add arrows to every line above, and it seems hard to add more date to x axis. What the final result I want to get is like this:
Is it possible to plot the wind-arrow plot in R?
Plus: here is the demo data for plot
structure(list(date = c("2016-04-01", "2016-04-01", "2016-04-01",
"2016-04-01", "2016-04-01", "2016-04-01", "2016-04-01", "2016-04-01",
"2016-04-01", "2016-04-01", "2016-04-01", "2016-04-01", "2016-04-01",
"2016-04-01", "2016-04-01", "2016-04-01", "2016-04-01", "2016-04-01",
"2016-04-01", "2016-04-01", "2016-04-01", "2016-04-01", "2016-04-01",
"2016-04-01", "2016-04-02", "2016-04-02", "2016-04-02", "2016-04-02",
"2016-04-02", "2016-04-02", "2016-04-02", "2016-04-02", "2016-04-02",
"2016-04-02", "2016-04-02", "2016-04-02", "2016-04-02", "2016-04-02",
"2016-04-02", "2016-04-02", "2016-04-02", "2016-04-02", "2016-04-02",
"2016-04-02", "2016-04-02", "2016-04-02", "2016-04-02", "2016-04-02"
), time = c("0:00:00", "1:00:00", "2:00:00", "3:00:00", "4:00:00",
"5:00:00", "6:00:00", "7:00:00", "8:00:00", "9:00:00", "10:00:00",
"11:00:00", "12:00:00", "13:00:00", "14:00:00", "15:00:00", "16:00:00",
"17:00:00", "18:00:00", "19:00:00", "20:00:00", "21:00:00", "22:00:00",
"23:00:00", "0:00:00", "1:00:00", "2:00:00", "3:00:00", "4:00:00",
"5:00:00", "6:00:00", "7:00:00", "8:00:00", "9:00:00", "10:00:00",
"11:00:00", "12:00:00", "13:00:00", "14:00:00", "15:00:00", "16:00:00",
"17:00:00", "18:00:00", "19:00:00", "20:00:00", "21:00:00", "22:00:00",
"23:00:00"), ws = c(0.6, 0.6, 0.3, 0.3, 0.5, 0.5, 0.4, 0.4, 0.4,
0.6, 0.9, 0.4, 0.9, 2.3, 2, 2.5, 2.6, 2.4, 2, 2.2, 1.7, 1.2,
1, 1, 1.4, 1.1, 1.4, 0.8, 1, 1.5, 1.2, 1.3, 1.4, 1.3, 2, 2.1,
2.7, 2.2, 2.1, 2.5, 1.9, 2, 1.7, 1.9, 1.2, 0.4, 0.5, 0.4), wd = c(179,
151.5, 200, 178.7, 205.5, 115.1, 110.9, 175.7, 192.9, 121, 117.5,
171.7, 204.8, 160.7, 169.3, 171, 169.4, 172.8, 154.5, 170.6,
151, 131.1, 105.3, 109.5, 141.9, 137.1, 113.7, 116.6, 88.7, 110.1,
99.9, 105.5, 98.4, 101.3, 128.6, 146.9, 148.1, 148.4, 152.5,
144.1, 145, 160, 179.2, 147.3, 156.6, 147.1, 158, 157.9)), .Names = c("date",
"time", "ws", "wd"), class = "data.frame", row.names = c(NA,
-48L))
________________________________update________________________________________
Sorry for not emphasising my problem.
Thanks @koekenbakker ,the function doing well in plotting the wind direction and the speed in one plot.Otherwise,my problem may focus more on how to convert the wind plot to a dynamic plot.(dynamic in date selection is enough)
geom_line
andgeom_spoke
witharrow = arrow()
(you'll need to convertwd
to radians), but for the life of me I can't get the arrows to point in the right directions. – Spadageom_line
andgeom_segment
witharrow=arrow()
using thesin()
andcos()
.But it still be hard to dynamic display the result. – Simulatorpaste()
andstrptime()
– Simulator