Finally we’ll attach the new variable to the main dataset. We’ll also generate some pretty labels and assign them as levels of the new object. Now we generate a factor variable, exchanging the directions with the ranges. First we will define the bin width (30°), then we will define dir.breaks which stores the range of each bin as follows 345°-15°, 15°-45°, 45°-75° etc. There are various ways to split and plot these data. That looks like a reasonable distribution of directions, favouring 225°.
Hist(data$direction, main = "Histogram of hypothetical direction frequencies.", xlab = "Direction", ylab = "Frequency") For this tutorial I will simulate 100000 directions using the wrapped normal function (rwrpnorm) from the CircStats package. The dataĪs I mentioned, my data was related to seal swimming directions, gathered from satellite tags. In fact, if you look through the ggplot2 call, it is basically a histogram until the last couple of lines, where it is wrapped into a wind rose.
In reality it doesn’t matter too much what you want to plot, and these sorts of plots are more generally used for wind direction illustrations. In my article I wanted a graphic which illustrated the preferred outward post-moult migration direction of adult female southern elephant seals from Marion Island.
ROSE DIAGRAM R HOW TO
As before, I relied heavily on Stack Exchange and many other sites for figuring out how to get my plot looking the way I needed it to, and so this is my attempt to contribute back to the broader community. This is another post regarding some plots that I needed to make for a publication.