Using redundant encoding with a scatter chart
It is very typical to display values for categorical dimensions using a bar chart. This is a very powerful and simple way to understand a chart. The length of the bars models the values in a very intuitive way.
Sometimes, however, it can be valuable to add an additional level of encoding to gain additional insight.
In this example, we are going to add space as an additional encoding. We can do this using a scatter chart.
Getting ready
Load the following script:
LOAD * INLINE [ Country, Sales USA, 100000 UK, 60000 Germany, 50000 France, 45000 Canada, 30000 Mexico, 20000 Japan, 15000 ];
How to do it…
Use the following steps to create a scatter chart demonstrating redundant encoding:
- Create a new scatter chart.
- Add a calculated dimension with the following expression:
=ValueList(1,2)
- Deselect the Label and Show Legend options for this dimension.
- Add
Country
as the second dimension. - On the Expressions tab, add two expressions:
Sum(Sales) If(ValueList(1,2)=1, 0, Sum(Sales))
- Both expressions can be labeled as Sales $:
- On the Sort tab, select the Country dimension and turn on the Expression option. Enter the expression:
Sum(Sales)
- The direction should be Descending.
- Go onto the Axes tab and select Hide Axis under the X Axis options.
- On the Numbers tab, format both expressions as Integer.
- Click on Finish.
- The chart displays with apparent bars and spacing between them. We can quickly see how much bigger the gap is between the USA and other countries. We can also identify clusters of similarly performing countries.
How it works…
If a scatter chart has two dimensions, it will change from displaying bubbles to displaying lines between the values in the first dimension.
The first expression here positions where the bars will exist. It is our space encoding.
The second expression has a test to see if it is ValueList = 1, which sets a value of 0, or ValueList = 2, which sets the Sales $
value.
There's more…
This is an example of the use of pseudo dimensions using ValueList
. This can be a very powerful function in dimensions.
The more frequent first dimension of a multidimensional scatter chart would be a date dimension, such as a year. This gives you the option to show lines going from year to year. Additional options in Presentation allow such items as arrows.