Adding an Axis Label to the Top of a Reversed Axis Bar Chart in Tableau
Ever wanted your axis label to move up when you reverse your axis?
Then, you are in the right place.
I also wanted to do this and accidentally found a hack after considering the use of a discrete placeholder. Yes, you heard it right — discrete placeholders are the hack you’ve been looking for.
When creating visualizations in Tableau, small tweaks can significantly enhance the readability and impact of your charts. One such tweak involves using discrete placeholders to add an axis label to the top of a reversed bar chart.
Why Discrete Placeholders?
In Tableau, reversing an axis often causes the axis label to end up at the bottom of the chart, which can make the visualization less intuitive. By using a discrete placeholder, you can reposition the axis label to the top, ensuring that your chart remains clear and easy to understand.
Before and After Example
Take a look at the example above. On the left, you see a basic bar chart without a top axis label. On the right, the same chart is improved with a discrete placeholder that adds a clear, concise axis label at the top.
Steps to Add a Discrete Placeholder
1. Set up your initial chart:
- Place your Dimension on the Columns shelf.
- Place your Measure on the Rows shelf.
- Click the axis on the left, select ‘Edit Axis’ then tick the ‘Reversed’ box. You should see something like this.
2. Create a Placeholder Field:
- Create a calculated field named PlaceHolder which contains
AVG(0)
.
Note: The placeholder can be anything other than AVG(0); it could be MIN(0), MAX(0), ‘dummy’, etc.
- Place this field on the Columns shelf just in front of your first dimension.
- Alternatively, you can edit directly in the Columns shelf and type
AVG(0)
.
3. Convert to Discrete:
- Click the drop-down on the placeholder field and select discrete.
If this step is confusing, you can simply type 'dummy'
directly in the Columns shelf and skip the previous steps.
4. Format and Hide Headers:
- Hide the header of the placeholder by right-clicking on the placeholder axis and deselecting ‘Show Header’.
- Format the chart as desired.
By following these steps, you can reposition your axis label to the top of the chart, making your data visualization clearer and more effective.
About the Author
You can follow Ayodeji Omokehinde Eseohe on Twitter and LinkedIn.