library(tidyverse)
setwd("~/R/")
dat = read.csv(file = "wind_data.csv",header = T)
dat<-as.data.frame(dat)
dat$x0=as.POSIXct(dat$date)
dat$y0=0
dat$x1=dat$x0+dat$ws* cos(dat$wd / 180 * pi)
dat$y1=0+dat$ws* sin(dat$wd / 180 * pi)
dat%>%ggplot(aes(x = factor(x0))) +
geom_segment(aes(y = y0, xend = x1, yend = y1), arrow = arrow(angle = 30, length = unit(0.2, "cm"))) +
ylim(-15, 15) +
coord_fixed() + #
scale_x_discrete(label = dat$date) +
labs(x = NULL, y = NULL) +
theme(axis.text.x = element_text(angle = 90, size = 4))
|