Using dual, un-synchronised, axis for flexibly placed labels
During a recent Makeover Monday I wanted to create a small multiple chart to visualise the individual player salaries for each NBA team during the 2017/18 season. In addition to the small multiple scatter plots, I wanted to place logos and summary details for each team; as demonstrated in the image below:
This caused me a headache as I wanted the team logo to be placed to the left of the chart and the summary details aligned to the right of the chart; the standard Tableau labelling options didn't provide me with sufficient flexibility in terms of positioning of the text.
The standard Tableau labelling does allow you to right align labels, however the labels appear directly to the right of the shape and as such would not achieve my desired visual. In addition I wanted the label coloured based on the team overspend or underspend and the standard labelling options only allows you to match the label colour to that of the shape and I didn't want the logo coloured.
Using dual axis, but not synchronising the two axis
To overcome the challenge I started exploring dual axis functionality. Whenever I have used dual axis charts in the past I have always synchronised the axis as I had usually been visualising the same metric in two different ways.
This time I deliberately wanted to explore not synchronising the dual axis, but why did I choose to do this? By having different axis scales I could be flexible with where I placed the team logo and the associated text.
- First I created the dual axis based on the fictitious measure of Max(0.5). By choosing 0.5 rather than 0 it allowed me increased flexibility with the axis scales, which will become important in subsequent steps.
- Next I assigned text to the first marks card of the dual axis; this text was the overspend or underspend against salary cap and the number of players earning over $20 million.
- The team logo was assigned to the second marks card.
- To achieve my desired placement of the team logo and text I amended the axis scales of the two axis as follows:
The text axis was set to range between 0 and 0.625; thus ensuring the 0.5 measure value was placed to the right of the axis. This is why it was important to set the dual measure as a decimal value as opposed to a whole integer.
The team logo axis was set to range between 0 and 3; thus placing the team logo to the left of the axis.
- The final steps were the 'tidying up' steps, hiding the axis headers and placing the appropriate colour on the text marks card.
This technique provided me with the flexibility I needed and helped me achieve the visual I desired, the final viz is below and can also be accessed via my Tableau Public profile (https://public.tableau.com/profile/simon.beaumont#!/vizhome/MakeoverMonday-2018Week29NBASalaryCap/MakeoverMonday-2018Week29NBASalaryCap).