Who said that geometry will not be useful?

 

As I was searching for a way to visualize the evolution of the military expenses by country, I come across a nice visualisation in Pinterest (Pinterest - www.respromasks.com)

And I thought, let's do it in Tableau Viz here

 

 

Why?

Below, you can see the original view. I have to admit that I prefer this display, it is easier to read and I will not even think about doing it otherwise in my daily business activity. But I wanted to have fun and do something different, I have never seen in Tableau.

 

 Moreover this "Snail graph" has the advantage to emphasize the incredible evolution of the US military expenses.  I have published the 2 approaches in Tableau Public, so you can tell me, which one you prefer.

 

How to do it and read it?

To do this visualisation, I didn't used any images and I draw all the visualisation, legends and axis in Tableau using geometric formulas. Who said that after school we will never use it anymore? The idea behing this graph is that each year correspond to a special angle ( between pi/2 and 2pi). Further a point is from the origin and higher is the value. And the triangles represents the evolution from the previous year (dark grey represents an increase). The size of the triangle represents the projection of the previous value on the following year axis.

With this non traditional graph you have to add a "how to read it" section, 
so the reader knows how to interpret it.
 

1. Polar Axis 

The Polar Axis was created by doing an union of the same data source. It will create a Table Name dimension that we would be able to use on the viz later.

 

The idea is to draw for each year a line between 0 and the max of the datasource ( most probably the US expenses)

  • In Column : IIF([Table Name]="Table2",[x polar],0)
  • In Rows : IIF([Table Name]="Current USD (2)",[y polar],0)
  • Marks : Lines
  • Details : Year
  • Path : Table Name

with x polar = COS(-3*PI()*(YEAR([year])-1949)/(2*(2019-1949)))*{ FIXED [year]:MAX([expenses)}

and y polar = SIN(-3*PI()*(YEAR([year])-1949)/(2*(2019-1949)))*{ FIXED [year]:MAX([expenses])}

 

Polar coordinates are normally calculated that way :

  The idea here is to have the expenses maximum per year ( Fixed LOD)=r. As the axis has to go between -3pi/2 (=pi/2) and 0, I divided the axis by the number of years between 2019 and 1949 and my angle goes further when the time goes away from 1949. Meaning that in 1949 the expenses will be represented on the horizontal bar (y=sin(0)=0) and in 2019 the expenses will be represented on the vertical bar (x=cos(-3pi/2)=cos(pi/2)=0)


2.Circles

I created also some partial circles in Tableau, to give a depth feeling( here in a darker color to see it better :)

To give this impression I created concentrated circles ( created randomly) and I limited them so they do not go further the US expenses lines. To publish in Tableau Public I had to create the dataset in Prep because the random calculation was creating issues once published.

  • column : if abs([x circle])< abs([x max]) then [x circle] END
  • row: if abs([y circle])<abs( [y max]) then [y circle] END
  • Marks : line
  • details : country
  • Path : year

with x circle=COS(-3*PI()*(YEAR([year])-1949)/(2*(2019-1949)))*{ MAX( [expenses])}* { FIXED [Country]:min(random())}

and x max=COS(-3*PI()*(YEAR([year])-1949)/(2*(2019-1949)))*{fixed [year]:MAX([expenses in US m])}

so the distance will never go deeper than the max.


3.The Snail Graph

To create this view you need to used the mark polygons, but you need also some prep in Tableau Prep.

  • Create a calculated field called y+1=DATEADD('year',1,[year])
  • Join the expenses data with itself on the condition country=country and year=year+1, so on the same year I will have the expenses of the previous year. 
  • Create 2 fields to calculated the projection of the previous expenses calculation on the following year  : x'= cos(-3*PI()*(YEAR([year])-1949)/(2*(2019-1949)))*[expenses previous year] and y'=sin(-3*PI()*(YEAR([year])-1949)/(2*(2019-1949)))*[expenses previous year]
  • Duplicate the data by joining the result with a table containing 3 rows and 2 column an index column (0-1-2) and a ONEcolumn ( value=1). The second column will server to join the 2 tables together and multiply the value.
  • On the last steps of the flows I created the following calculations to be able to draw the triangles
x area :
if [index]=0 then [x previous]
ELSEIF [index]=1 then [x']
ELSE [x]
END
 
y area :
if [index]=0 then [y previous]
ELSEIF [index]=1 then [y']
else [y]
END


You can then create calculation to change the color depending if the expenses are growing or decreasing 
color= [expenses previous year]>[expenses]

To construct the viz :
  • column : x area
  • row: y area and y area ( dual axis)
  • Marks :Polygon
  • details : country and year
  • Color : color
  • Marks : line
  • details : index
  • Path : year
  •  Color : country
 

4.The Legend

 The last part of this viz is about the color legend. That has been done in Tableau too.


  • column : year
  • row: color text and avg(random)
  • Marks :Line
  • text : color text
  • Line : avg(random)
  • Color : color 

with color text = if [color] then "DECREASED" ELSE "INCREASED" END 

In conclusion, I really had fun building it in Tableau, but because I could doesnt't necessary mean I should have. For the axis and the circles, I could have done it more efficiently in another drawing tool I assume, and maybe this view is not the most efficient one, but it convey quite way the message of the crazy military expenses done in the US.


Just message me and tell me if you prefer the snail version of the more traditional visualisation

For the snail : vote 1

 

for the other one : vote 2

 

and if you have some suggestion on how to call this visualisation... I am open to suggestion :)


Rati 30.08.2020