The Cycle of Influenza – Creating a Radial Time-Series Chart

For a recent #MakeoverMonday submission I created a radial chart plotting the seasonal impact of influenza-like illnesses. After publishing it to Twitter I received a ton of positive feedback about the visualization. Folks loved it. I was so humbled by everyone’s comments that I wanted to share both how I ended up with the viz and details regarding how to recreate it yourself.

Let me start off by saying, what you see was not my first (or second, or third…) attempt at visualizing this data set.

Success consists of going from failure to failure without loss of enthusiasm. -Winston Churchill

Take a ‘pause for the cause’

I use this phrase a lot with my five-year-old son at home. I’m not sure if he understands it or not, but I find myself telling him to ‘pause’ when he’s frustrated or overwhelmed or just whining too much. There are times when it’s helpful to remember this phrase even in data visualization.

It’s not always clear why I struggle with some data some weeks and not others. The influenza data was pretty straight forward and was a topic I was interested in, but for some reason I couldn’t find the story I wanted to tell and couldn’t get a visual that excited me. Regardless, I wasn’t going to give up and I wasn’t going to just complete something I didn’t like.

So I took a break.

I literally had three different examples of dashboards and then I called it quits for a day. After 24+ hours, I came back to the data and my seasonal radial chart took shape immediately. With fresh eyes and fresh ideas, I was able to put this together relatively quickly. After many failed attempts, I ended up with something I really like looking at.

Moral? Obviously, it’s that you should keep trying. You will get there. Plus, you learn a TON of things that don’t work along the way. Those things that don’t work in one viz, just may work in another viz – so your efforts are not for nothing!

Creating a radial time-series chart

Influenza

The Calculations

There are a lot (I’m guessing) of explanations out there on how to create a radial chart, but I always find the instructions confusing because I want to know the ‘why’. Why did you do something? What does that calculation do? I’ll try to explain here what I did.

There are five basic calculations you will need:

  1. Radial Position – This will determine what data point goes where along the circumference of each circle. For my viz, the top data point (at 12:00) was week 1 – or January 1st, but I could have just as easily made it week 40, which is defined as the start of flu season.
  2. Circle Radius – This is going to be what positions where your circles rest within each other. For example, what defines what data value is the smallest circle at the very center and what is the largest around the outside. For my viz, the smallest year (2007) was in the middle and the more recent year (2018) was on the outside.
  3. Angle – This is used to break down your data points evenly across the 360º of a circle. In my viz, my data was broken into 52 weeks, or 360/52 to be the slices of the circle.
  4. X – This is the X coordinate.
  5. Y – This is the Y coordinate.

Okay so let’s build them.

Radial Position

For my viz the calc was [Week]-1 – This was because I wanted week #1 to be at position 0 around my circle. On the left you can see that week 1 is at the top (remember the first week of Winter is in December, which is why the gray isn’t at the top, but I could have done that as well instead). On the right, is what happens if I change my calculation and make week 40 at the top. It’s a good idea to play around with your calcs to see what they really are doing!

Circle Radius

For my viz the calc was YEAR([Year])-{FIXED : MIN(YEAR([Year]))} – This basically means that I wanted the smallest year on the inside and to have a radius of 0. This actually isn’t what I would want at all if I kept all of my years in my viz, but I actually filtered some out.

On top is my calc, but since I have years filtered, the first year is actually not at the center. Second, is my calc if I leave all years in. What happens is that the smallest year actually has a radius of 0 so it’s quite squished. Last, is an update to my calc with “+10” added to the end. This now makes the radius of the first year in the data set out 10 coordinates. You can adjust yours based on the range of your data set. Again, play around to see what happens and what you like!

Circle Radius1
My calc with filtered years
Circle Radius2
My calc with all years
Circle Radius3
Updated calc with all years

Angle

For my viz the calc was [Radial Position]*(360/52) – This took the radial position (remember because I was using 52 weeks, I had 52 positions from 0-51) and then plotted them around the circle. To recreate this for another data set, you will need to take the radial position multiplied by the number of angles you need. Again, with 52 weeks I did 360/52. If I break my calc and make it [Radial Position]*(360/75) the angles are smaller (and obviously don’t complete the circle).Circle Radius4

The X and Y Coordinates

These are pretty standard, and you will likely see them in vizzes by many other people. This is just going to create the coordinates that you will plot.

X – [Circle Radius]*COS(RADIANS([Angle]))

Y – [Circle Radius]*SIN(RADIANS([Angle]))

Finishing Up the Viz

Now that you have all the calculations, you just need to construct the viz.

  1. Y goes on columns
  2. X goes on rows
  3. Add your level of detail (for me it was Weeks) to details.

Final Thoughts

Don’t forget to clean up your viz. One of my biggest pet peeves is poor formatting. Spend the time to clean up grid lines, dust off your tool tips, and pick appropriate colors. Sometimes it is the little things that can make a viz go from ‘nice’ to ‘holy shit, that’s awesome’. Seriously, it can happen. So pay attention to the small stuff, learn why others do what they do (and if they don’t tell you, I’d suggest asking), and then try – and try, try again. And do it, as Churchill suggests, with enthusiasm. Come, on, how can you not be enthusiastic using Tableau? Just me?? Nah, I doubt it.

Enjoy!

Lindsay

3 comments

  1. Fantastic post Lindsay.. ‘Pause for the Cause’ this is really a great quote which I started using quite often in my day to day life..

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s