Since I published my ‘Paying a Premium‘ visualisation yesterday, a number of people have asked me about the annotation style I used:
Most people assumed that I had built these annotations from scratch; either manually in Tableau using a combination of lines and text boxes, or in another tool such as PowerPoint. However, I actually built these in Tableau using standard functionality!
Let’s explore the annotation options in Tableau and learn how to apply something similar in your own work.
How to Add an Annotation in Tableau
Once you have built a visualisation in Tableau, you can add an annotation by right-clicking on a mark you would like to annotate in your viz (you can do this from a worksheet or directly on a dashboard).
Upon doing so, you’ll be presented with this menu:
From the annotation menu, you’ll notice there are three annotation types:
- Mark – This will create a text box pre-generated with your mark details. These will usually be the same details included in your tooltip. As always, you can edit what text this box includes, as well as any text formatting. The mark option will also generate a line between your selected mark and the annotation text box.
- Point – Similar to the mark option, point will create a text box with a line between your selected mark and the annotation text box. The only difference with this option is that the annotation text box will be blank, allowing you to enter any text you wish.
- Area – Similar to the other two options, area will create a blank text box for your annotation text. However, with this option there is no line between your selected mark and the annotation text box.
Select the annotation option from the annotation menu which best suits your requirements. If you select Mark or Point, you’ll first be presented with the text box window for editing, otherwise your annotation will be displayed in the view.
Once you have created your annotation, you can customise the design from the format annotation menu. To access this menu, right-click on your annotation text box and select ‘format’. The menu will then be displayed on the left-hand side.
Format Annotation Options
The default ‘Format Annotation’ menu and settings are presented like this:
Let’s explore these options one-by-one.
The Box menu gives you the ability to change the type of box (border) applied to the annotation. There are three options in this menu:
- Four-sided – Selecting this option will create a four-sided box around your annotation text. A four-sided box will look something like this (note I have applied some formatting to the border lines so they are clearly visible in the example):
- Single-edge – Selecting this option will create a single-edge border only. This option will create a single-sided box which looks something like this:
Please note, the placement of the single edge will change depending on how your visualisation is set up. For instance, on my ‘Paying a Premium’ viz, some of my annotations had the single-edge displayed at the top.
- None – Selecting this option will remove the box/border entirely:
The default annotation shading is 90% and greyscale. This means that the background of the annotation text box will be shaded grey and the background will be slightly (10%) transparent. This type of setting can be useful when your annotation covers other parts of your viz which you still want to be visible, whilst the grey shading will help keep your annotation text legible.
From the shading menu you can apply a different background colour, adjust the transparency of your annotation background or remove it altogether.
Below are a few examples of how this might look.
By default, the annotations on my ‘Paying the Premium’ dashboard looked like this:
However, the greyscale shading doesn’t work particularly well on dashboards with dark backgrounds.
Instead, I removed the shading completely (by changing the shading colour to ‘None’) and changed the text colour to white to achieve this look:
On a dashboard with a white background, the default shading/opacity options might look something like this:
In this example, I have added an annotation to a mark in a scatterplot. Since I want the other marks behind the annotation text box to remain visible, I kept the default grey shading but reduced the opacity to 60%:
The default border option is ‘None’. However, you can apply a number of border styles and weights from the border menu including dashed or dotted lines, as well as adjust the border to a colour of your choice.
This is where we can change the style of the annotation border corners. Please note, these options will only work with the four-sized box style.
There are four corner options in the corner menu:
- Square – Corners will be square
- Rounded – Corners will be slightly smoothed and rounded
- More Rounded – Corners will be more smooth and rounded
- Very Rounded – Corners will be very smooth and rounded
From the line options menu we can adjust the annotation line and line end styles.
From this menu we can apply different styles to our annotation line (the line which connects the annotation text box to the mark). Styles include solid, dotted and dashed. We can also adjust the weight, opacity and colour of the line from this menu.
From this menu we can apply four difference line end styles:
- None – This is the default option. With this selected, the annotation will be a standard line-only with no arrow or dot at the end.
- Arrow – This option will add a solid arrow to the end of your annotation line
- Open Arrow – This option will add an open arrow to the end of your annotation line
- Dot – This option will add a solid dot to the end of your annotation line
Resizing and Positioning
Once you have your annotation formatted to your liking, you can adjust the placement of both the annotation text box and line directly in the viz.
You can do this by clicking on the annotation on the viz. In doing so, a red box and yellow triangle will appear:
You can resize the annotation box by selecting the green squares either size of the red box. This will enable you to adjust the width of the box by clicking and dragging the box from left to right (the height is determined by the amount of text contained within the box so this cannot be adjusted in the same manner).
You can reposition the end of the annotation line by selecting the yellow triangle. This will enable you to adjust the length of the line and the placement of the line end-point.
Below are some examples of where I have applied different annotation styles in my work.
Click on any of the images below to view the interactive versions in Tableau Public.
Paying a Premium
This was the viz which inspired this post. In this example I have used single-edge boxes with no line ends:
A History of Hotels in Las Vegas
In this example I used annotations with very rounded edges and dot line-ends:
UK Unemployment Rates
In this example I used area annotations (no lines) with 85% shading so any reference lines behind the annotation boxes are still visible:
I hope you found this post useful.
Thanks for reading!