Today, I gave a workshop called “Visualizing Data with Tableau” as part of the Michigan State University Digital Humanities Workshop series for Fall 2016. The tutorial below covers everything we introduced in the workshop, including:
- Getting set up with Tableau Public and loading in data
- Creating a map
- Creating an area chart
- Creating a tree map
- Compiling a dashboard
- Publishing to the web
[Update: You can also build on this tutorial by adding a georectified map to Tableau. Learn how to georectify a map here, and learn how to put it into Tableau here.]
Before we get started, a few introductory things:
Why Tableau? There are MANY options out there for data visualization. What makes Tableau extremely useful is:
- There are many options for visualizing information, from maps, to bar charts, to bubbles and treemaps. Tableau lets you bring together a range of viz types in one place and to play and experiment among them with the same dataset. It’s a useful space for learning how to structure your data to tell the story or make the argument you want to convey.
- Interactivity – This is the easiest tool I have found for creating interactive visualizations that doesn’t require coding skills.
- Context – Not only can you show a visualization, but you can customize the display to include contextual information, such as data sources, images, sound, and additional text. The ability to provide context helps create a visual argument which is essential for a successful viz.
- Easy to publish online and to embed – If you want to share your visualization (and data, if you want), you don’t have to create a separate website to host it. You can simply send people to your Tableau profile. Alternatively, you can embed your Tableau visualization on your own website easily.
The data used for this tutorial comes from my personal research (see here for more) and comes from the Roman de la Rose Digital Library. It shows locations of surviving manuscript copies of one medieval book, the “Roman de la Rose” and includes information about the manuscripts, such as: the institution where the book currently is held; the approximate date of its creation; whether the manuscript has any illustrations, etc.
Be aware: It is important to note that Tableau is a commercial software, and as such operates on a freemium basis. A Tableau Public account is free to use, but it requires you to create a free account and to save your workbooks to publicly to its website. If you are concerned about privacy or are not connected to the internet (and therefore unable to save your work), take a screenshot of your visualization. Another option is to explore Tableau’s academic accounts. Applying for one of these accounts will allow you to download the full Desktop version, which has basically the same capabilities of Tableau Public BUT it allows you to save work locally to your computer. Academic licenses are available to teachers and students for classroom and research purposes. Find out more at tableau.com/academic. [The Tableau Desktop version usually costs a whopping $999/user.]
A final note: This workshop heavily built upon one Bobby Smiley and I ran in 2015 on the same topic. Find the tutorial for that workshop here.
Part 1 – Getting set up
- Download Tableau Public for free at public.tableau.com
Note: This tutorial uses Tableau Desktop Public Version 10.0.1 - Create a free profile at public.tableau.com (this step is required to publish your data to the web and thereby to save it)
- Download the csv datafile found here
- Open Tableau and click “text file”
Note: Tableau 10 allows you to connect to Google Drive and to use a Google Sheet instead of a csv or excel file. For this tutorial, we are using a csv, but the benefit of using Sheets is Tableau will update as you add or change the content of your Sheet. To connect a Google Sheet to Tableau, either select “Google Sheets” or click “More” under the “To a Server” section, where you will see Google Sheets as an option. - Open the csv file you just downloaded
- Tableau will look like this:
In the bottom half of the screen, we see the same information from the csv spreadsheet, and the top row shows column names as well as types of information. Note the icons below Latitude and Longitude. Below Longitude is a small globe, which indicates that Tableau recognizes the column’s information as geographic data. However, the icon below Latitude is a hash – this means that Tableau thinks this data is numeric, not geographic. Let’s fix Tableau’s error. - Select the small hash icon below Latitude, and select “Latitude” in the “Geographic Role” section. Note that the icon then changes to the small globe, just like the Longitude column.
When working with your own data, you may have different types of geographic information – note that you have other ways to ID this info – area code, city, etc. - Once the data types are all correct, click the orange “Go to worksheet” button in the center of the screen.
Part 2: Creating a Map
- You are given a blank workspace. On the left of the screen are each of the data columns/types. Those identified as strings (Abc) are listed under “Dimensions.” Other types of data (Numbers or Geo) are listed under “Measures.” For our purposes, “Date end” and “Date start” are listed as Numbers (#), but later we will treat them like strings. So, control click on them and drag them into “Dimensions.”
- Let’s put this data on a map. Control/Command click on “Latitude” and “Longitude.” Once you have selected one or more data type from either Dimensions or Measures, the “Show Me” box in the top right of your workspace will highlight with a blue box any visualization types that work with the data types you have selected. For Latitude and Longitude, we see that the map visualization is highlighted in blue. Click on the map.
- Now we can see a map, with a single point on it. Tableau has taken an average of all the Longitude and Latitude data (note the green boxes toward the top of the screen. Let’s fix this by telling Tableau to plot each point in the dataset. Select “Id” from “Dimensions” and drag and drop it onto the “Detail” box.
- Now we can see a map with many points around the world. Let’s size the points based on how many manuscripts (items) are at each location (based on Lat/Long). Select “Id” from “Dimensions” again and drag and drop it onto the “Size” box.
- Now we can get a sense of what places in the world have the highest density of these manuscripts. I have zoomed into show Europe for the moment because it has the most items in the dataset. Let’s add in some more information to the map. Let’s color the bubbles based on the number of manuscripts at each location that have at least one illustration. Select “Number of illustrations” from “Measures” and drag and drop it onto the “Color” box.
- Now the bubbles show color gradation along a spectrum. See the “SUM(Number of illustrations)” box toward the lower right of the screen. If you click on the drop down arrow within that color spectrum box, you will see a list of options, select “Change Color”.
- Change the color by clicking on the drop down “Palette” bar. You can change the display from showing color gradations on a continuous scale to showing points in 5 (or any number) of color buckets. To do so, check the “Stepped Color” box and adjust the number of steps you want to break down the color variation by. In the “Advanced” section, you may adjust the “Start”, “End”, and/or “Center” color values to correct for extreme outliers.
- Select “Institution” from the “Dimensions” pane and drag and drop it onto the “Label” box. Now the map displays labels for each Lat/Long point on the map. In the center pane, click on the drop down arrow of the “Institution” box, and select “Show Filter.”
- A panel with a list of all institutions on the map now displays next to the map. This is a way to filter the information to only see manuscripts on the map from one or several institutions.
- At the bottom of the screen, double click on the “Sheet 1” tab and rename it.
Part 3: Creating an Area Chart
- Next to the tab you just renamed, click on the small graph tab. This will open a new workspace. Let’s create another visualization.
- Control/command click on the “Date start” field from “Dimensions” and “Number of Records” field from “Measures.” See how the “Show Me” box adjusts to select the best visualization for the data types selected. Click on the highlighted bar chart visualization.
- Tableau puts the dates on the Y-axis (Rows) and Number of records in the X-axis (Columns). At the top of the screen, switch those two by dragging and dropping.
- Let’s change the type of graph to an Area chart. In the “Marks” area, click on the drop down box and select “Area” instead of “Automatic.”
- Now that you have an area chart, rename the sheet. Then, click on the tab next to it to create another workspace.
Part 4: Creating a Tree Map
- Select both “Number of Records” and “Institutions.” Note how in the “Show Me” menu, Tableau suggests most strongly that you choose the horizontal bar charts, like when we created the area chart. Instead, let’s select the Treemap visualization, which is also colored in to show that it will work with this type of data.
- Add in the number of items for each box shown by dragging and dropping the “Number of records” into the “Label” box.
- Now you have a Treemap with labels. You can change the color of the Treemap by clicking on the “color” box in the center panel and choosing a new color from the “edit color” box. Then, rename the worksheet and click on the tab in the bottom right of the screen. This will open a Dashboard for displaying your visualizations.
Part 5: Compiling a Dashboard
- You will have a blank screen, which looks similar to the worksheets. First, adjust the size of the working area by clicking on the dropdown box in the lower left to change “Size” from “Range” to “Automatic.”
- Then, drag and drop each of your worksheets into the central work area.
Note how the filters and legend information for each visualization is now detached from its original visualization type and clustered on the right of the dashboard. - When you click on any of the content boxes on the dashboard, note the gray bar at the top. Move the box around within the dashboard by clicking and dragging the top center of the box. Delete the box from the dashboard [this will not delete the information, just your ability to see it on this particular dashboard] by clicking on the X in the top right. Resize the boxes as you like by dragging any of the four sides.
- Pair up any legend information you want to display on top of its relevant visualization. To move the “Number of illustrations” color gradation box onto the map, select the “Number of illustrations” box, click on the drop down arrow in the top right, and select “Floating.” Then drag the box over to the map area.
- Notice how the tree map only fills up only part of it’s content box. Click on the drop down arrow in the top right, and select “Entire View” under “Fit.” Now the tree map takes up the entire space of its box.
- To save space on the dashboard, eliminate the titles of each content box. Click on the drop down arrow in the top right of the box and uncheck “Show Title.”
- The “Institutions” checklist on the right of the dashboard currently only filters information to the map. To have it filter information for all 3 of the visualizations, click on the drop down arrow in the top right of the box and select “All Using Related Data Sources” under “Apply to Worksheets.”
- Uncheck the “Null” box in the “Institutions” list and note how the tree map in particular adjusts to now show only manuscripts that have a listed institution.
- Add a title to the Dashboard by dragging and dropping the “Text” button from the bottom left of the screen to wherever you want to put it on the dashboard. Format the text as you would in Word. Then resize the content box as you would any other.
- Add a data source box at the bottom of the dashboard using the same method of dragging and dropping “Text” to where you want it. Then, change the name of the dashboard in the bottom tab from “Dashboard 1.”
Part 6: Publish to the Web
- Select “Save to Tableau Public As” by clicking on File in the main menu.
Tableau will prompt you to sign in to your account.
Tableau will also prompt you to give a title to your visualization.
- Tableau will open a tab in a browser and display your dashboard.
Scroll down, and edit the title, description, etc as you like. Uncheck the box “Allow workbook and its data to be downloaded by others” if you do not want to provide access to the data to the public. If you want to display not just your dashboard, but also each individual sheet, check the box “Show workbook sheets as tabs.” This function will display the same information as the dashboard but show each sheet on its own, which you may find useful.
If you choose to show each sheet as a tab, it will look like this:
- Once you are done editing, click Save, and you can see your visualization. It is fully interactive, just like from within the Tableau interface. Share it via the URL you see. You may also share by embedding the visualization directly into your own website.
- TIP: If you want to embed the visualization into your website, you can use the embed code provided, as you see above. HOWEVER, if you want to have the embedded viz be responsive to screen size (so that it resizes to work on a tablet, phone, etc), instead use this code:
<iframe frameborder=”0″ height=”870″ scrolling=”no” src=”http://public.tableausoftware.com/views/romandelarose/Dashboard2?:embed=y&:display_count=y” width=”100%”></iframe>
Instead of the URL you see in the code above, use the URL provided by Tableau (see step 9 above). The width of 100% will resize based on the width of the screen. You can adjust the height as you prefer for your site. - REMEMBER that with a Tableau Public account, any visualization that you publish will be publicly accessible. The only way to save a worksheet and/or dashboard with a Public account is to publish to the web. One way to reduce the visibility of your visualization and thereby to increase privacy is to go to your profile, hover over the visualization, and click on the eye icon in the top right. This will make the visualization not display publicly on your profile. You can delete your visualization (which will delete it both from the Tableau Public website and will delete it entirely so you cannot use it in the future) by clicking on the trashcan in the bottom right corner. If you want to return to your visualization to edit it in Tableau, click on the download button in the bottom left corner.
You can also download your Tableau file to work on again from the online visualization itself by clicking on the “Download” button in the bottom right and selecting “Tableau Workbook.” This download option will not be available for others to select if you have unchecked the box to allow your data to be shared.
Pingback: Tableau Visualizations – Digital Humanities
Pingback: Working with a Georectified Map (Part 1: Mapbox & Tableau) – Kristen Mapes