Radial Graphs for Time Series

On How to: Weather Radials, there was a nice visualisation of temperatures. Since I am too old fashioned for ggplot2, I wanted to reproduce a similar graph with the old plot style.

Assume that daily temperature is in a vector X (e.g. temperature in Montréal, QC, in 2009). To get a radial plot, use

> n=length(X)
> theta=seq(0,1-1/n,length=n)*2*pi
> r=30+X
> plot(r*cos(pi/2-theta),r*sin(pi/2-theta),type="l",xlab="",ylab="",axes=FALSE)
> for(t in 1:n){
+   if(X[t]>0) CL=rgb(0,0,1,.4)
+   if(X[t]<0) CL=rgb(1,0,0,.4)
+   if(X[t]==0) CL="white"
+   segments((30+X[t])*cos(pi/2-theta[t]),(30+X[t])*sin(pi/2-theta[t]),30*cos(pi/2-theta[t]),30*sin(pi/2-theta[t]),col=CL)
+ }
> for(r in 10*seq(0,6)) lines(r*cos(pi/2-theta),r*sin(pi/2-theta),type="l",col="light blue")


OpenEdition suggests that you cite this post as follows:
Arthur Charpentier (March 24, 2016). Radial Graphs for Time Series. Freakonometrics. Retrieved January 24, 2025 from https://doi.org/10.58079/ov3c


2 thoughts on “Radial Graphs for Time Series”

  1. I like the red/blue choice for above/below freezing. 🙂

    There was a series of related blog posts and discussions about this topic in 2012. The data were multi-year temperatures, which requires changing to a “radial scatter plot.” I believe the series started with the SAS & R Blog:
    http://sas-and-r.blogspot.com/2012/04/example-925-its-been-mighty-warm-winter.html
    If you look in the comments you will see submissions that use ggplot and SAS.

    I wrote a follow-up post in which I say “trying to follow a sinusoidal curve as it winds around a circle requires too much head-tilting!” I show a simple way to create a loess smoother that handles periodic data: http://blogs.sas.com/content/iml/2012/04/05/smoothers-for-periodic-data.html

  2. Très belle visualisation, l’idée de la circularité pour l’année c’est vraiment adapté. Juste une remarque mineure, je m’attendais à avoir des couleurs inversées : rouge pour le chaud, bleu pour le froid, ici on a l’inverse.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.