This post explains how you can use background images in Tableau to visualise data on different floors of a building. The background floor plan image shown will change based on a filter value for the selected floor and will also filter the data to the selected floor.
The steps are as follows:
- Obtain/create floor plans
- Create X,Y coordinates for points to visualise on the floor plans
- Clean data and add other fields
- Open data in Tableau and create a Floor filter
- Add background images with a condition
- Format data points as needed
Obtain or create your floor plans
If you are visualising data for a large office or commercial building, hopefully you can obtain the plans from the facilities department, which will include all elements that you want to map, such as desk locations, exits, air conditioner units or other items for your analysis.
If you are visualising a small / simple area and don’t have plans, you’ll need to create them using something like Figma. I just used PowerPoint to create the very simple plans for this example.
Create X and Y coordinates
If you have a lot of points to map, you can use a tool such as Dave Hart’s Tableau Drawing Tool. This enables you to load an image and then click to capture the X and Y coordinates of each point. The help instructions on the site (on the right hand side) are quite comprehensive.
If you have a small number of points you can also capture the coordinates directly in Tableau. If you take this approach, you’ll need to add the image to Tableau first, so see the next step for how to do that.
Once the image is in Tableau, right-click anywhere on the image over a point that want to capture the X, Y coordinates for and select: Annotate > Point:
For example, below I want to obtain the X, Y values for the chair on this plan. After right-clicking on the point and selecting the above menu option, an Edit Annotation window will show:
Click OK and the annotation will appear, showing the X and Y value for the point that was clicked on:
You’ll need to manually collect these and put them into an Excel sheet which you will then connect to in Tableau. For this reason, this approach is only recommended where you don’t have many points to capture as it will be time consuming otherwise.
Clean data and other fields
In Excel, add the floor number and any other details you want to visualise such as a description of what is at that location (Desk, Exit, Fire Extinguisher etc.).
For this example, I have added the floor number only as every point is a temperature reading.
Connect to data and create a floor filter
Now you have your points mapped and other metadata added, connect to this file in Tableau, add the X field to Columns and the Y field to Rows, both as continuous dimensions. Then add a filter on the Floor dimension. Also, add the Floor dimension to the Detail shelf. This is so it can be used in the view and also so that this field can be used as a condition in the next step.
Add background images with a condition
To add the images, select Map > Background Images > Your Data Source Name
Click Add to add a new image and then:
- Add a helpful name such as “Floor 1”
- Browse to the first floor plan image on your computer
- Enter the max X and Y coordinate values. I am using 0 to 1 on both axes
- If desired, increase the washout slightly so the data points will stand out more.
Now click the Options tab and then click Add to add a new condition for when this background image should be shown in the view:
Click the Floor field and then select the relevant value for the floor plan you are adding, 1 in this case.
Click OK twice, and then Add to add the next floor plan and so on. When complete all images will be added with their relevant conditions:
Edit the Title to include the floor number so it is dynamic:
Format data points
Finally, we need to add the required visual encodings for the temperature data being visualised in this example. I will add the Temperature measure to the Colour shelf with a blue to red colour palette to represent cold to warm and make the marks larger.
The view can then be added to a dashboard and formatted as needed. When the filter is changed, the background image updates, the data is filtered to the correct floor and the title changes.
You can download the dashboard from my Tableau Public profile.
To learn about other ways you can use images in Tableau see this blog post.
Thanks for reading!