Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# Reset the wind scale to 1
wind_scale <- 1
# Now we use temperature for the y axis, so some things must change
ggplot(data = ERA_pixel, aes(x = date, y = temp)) +
geom_line(colour = 'salmon', show.legend = F, size = 1.5) +
geom_segment(aes(x = date, xend = date + u,
y = mean(temp, na.rm = T), yend = mean(temp, na.rm = T) +v),
arrow = arrow(length = unit(0.15, 'cm')), size = 0.5, alpha = 0.7) +
geom_point(aes(x = date, y = mean(temp, na.rm = T)), alpha = 0.5, size = 1) +
# Create the label box for our wind vector length legend
geom_label(aes(x = as.Date('2016-12-04'), y = 22, label = ' 4 m/s \n'), size = 5) +
# Create the segment for the wind vector legend
geom_segment(aes(x = as.Date('2016-12-02'), xend = as.Date('2016-12-06'),
y = 21.4, yend = 21.4), size = 0.5, alpha = 0.7) +
scale_x_date(labels = date_format('%Y-%m-%d'), breaks = date_breaks('4 days')) +
labs(x = NULL, y = 'Temperature (°C)') +
# Here we choose to allow ggplot to determine the best range for y axis values
coord_equal() +
theme(axis.text.x = element_text(angle = 20, hjust = 0.4, vjust = 0.5, size = 8),
axis.text.y = element_text(size = 8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment