# Plot angles around $360^\circ$ (North)

I want to plot wind angles. I typically have around 25 observations (the amount is not important here). I want to use a line chart to quickly see the trend (veering or backing) and the amount of oscillation. I also calculate statistics of the values.

Mostly this is trivial. But how to manage the situation when wind is around North?

E.g. I have observations 5, 10, 350, 345, 355, 0, 5. This produces a non-informative plot because the values are seemingly so separate although in reality they are not. Calculating average produces wrong result (153, the right should be 359).

OK, I get it right using negative values for the big numbers. (350 = -10)

Now the question: what kind of algorithm should i write to make a decision about when I need this value changing or is there another means to handle this?

• I'm far from being an expert in this are but here are some texts that may provide some guidance .. The Analysis of Directional Time Series: Applications to Wind Speed and Direction amazon.com/dp/0387971823/… Directional Statistics amazon.com/dp/0471953334/… – Mike Hunter Nov 16 '15 at 11:56
• Actually, I think I've answered a variation on this question previously. Please consider the following linke: Average and standard deviation of timestamps (time wraps around at midnight) In particular, this presents a statistically-sound method for determining the mean value of circular data, which is also the location parameter of the von Mises distribution. – Sycorax Nov 16 '15 at 13:55
• And if your remaining question is about plotting the data, I'd recommend just plotting the angle against some arbitrary radius (in polar coordinates). No loss of information, and it has an obvious visual meaning. – Sycorax Nov 16 '15 at 14:02
• @user777 "a bit of a nightmare": I know that is jokingly put, and circular statistics are strange territory on first encounter. But circular statistics can be simpler than mainstream (e.g. outliers are rare as they have so little space in which to hide) and just as beautiful; trigonometry and geometry appear naturally and helpfully. – Nick Cox Nov 16 '15 at 14:23
• @user777 Some over-mathematical statistician just threw you in at the deep end. I once attended a lecture by a very famous geophysicist (later murdered, but that's another story) who kept flagging that you need different statistics when you have directions. A very famous statistician was sitting behind me and kept muttering "Just different spaces, otherwise nothing different". They were both right. – Nick Cox Nov 16 '15 at 14:32

## 2 Answers

The question implies that you want a linear plot (and not a circular plot). That being so, a general principle that usually works is to rotate the scale so that the vector mean is at the centre. The vector mean is the arctangent of the ratio of the sum of sines to the sum of cosines. Some care is needed to catch the four-quadrant character of the calculation (not to mention the fact that most such data arrive in degrees and trigonometric routines commonly assume use of radian measure).

The vector mean for your example of $5, 10, 350, 345, 355, 0, 5$ degrees is $358.9^\circ$.

A direction close to the vector mean will often work just as well. For example, with one kind of circular data I work with, the vector mean is often close to North-East but, unsurprisingly, no law of nature makes that exact. A convention to put NE at the center of a scale is helpful, however. Let's spell out that it can be more helpful to choose a standard scale for a series of related graphs than to optimise each separately.

In the case of winds, winds from every direction at some time or another are likely in most topographic situations, although usually with different frequencies. (For a variety of reasons wind is rarely measured instrumentally on very steep slopes.) But note in particular that two modes opposite on the circle are possible in some cases, as when two modes are up-valley and down-valley winds (anabatic and katabatic), onshore or offshore, etc. In such cases, it can be best to avoid cutting the circle at a mode.

In general, two principles that usually do not contradict are

1. Put the vector mean at or near the middle of the scale.

2. Avoid cutting the scale (i.e. choosing the ends of the scale, which are necessarily identical) to cut a mode that is interesting or important.

One often cited example dataset in circular statistics concerns turtle migration between land and sea in which there are two modes for direction, and the usual wry comment is that evidently some of the turtles are confusing backwards and forwards. The same phenomenon has been observed in political science, although with different players.

Operating under the assumption than the period is 360 degrees, if the angle is greater than 180, subtract from 360. That should give you the right averages.

• Could you please expand on this thought? It's not immediately clear why this will produce a correct answer to OP's question. – Sycorax Nov 16 '15 at 13:47
• This is very unclear. Do you mean that $270^\circ$ should become $90^\circ$? If so, $90^\circ$ and $270^\circ$ are combined, which is usually not at all what is needed. If not, and you imply that $270^\circ$ should become $-90^\circ$, then that just moves angles from one side of the graph to the other. It doesn't do anything necessarily to make the graph more effective or easier to understand. – Nick Cox Nov 16 '15 at 14:15
• Following this recommendation, any set of angles fluctuating around 0 would be coded variously as values near 0 and other values just under 360, thereby averaging close to 180: just about as wrong as it possibly can be. This problem was specifically pointed out in the question itself. As a general principle, then, it seems like a poor choice. – whuber Nov 16 '15 at 14:50