This tutorial provides strategies for visualizing data using Tableau. This tool provides a myriad of options for visualization–maps, charts, scatter plots, trend analysis–to ensure your visualizations are as effective as possible.
Tableau offers a number of free options. Tableau Public is always free, but your data is publicly accessible. Tableau Public is available for download at https://public.tableau.com/en-us/s/ Tableau also offers free one-year licenses for private accounts to students and teachers. Teachers can sign up at http://www.tableau.com/academic/teaching and students can go to http://www.tableau.com/academic/students to obtain a free one-year license.
For this tutorial, you will be working with a cleaned subset of the Global Terrorism Database, an open-source database of terrorist incidents from around the world. The “Tableau Tutorial Data Set.xlsx” file can be found here. Download this file and save it to your desktop.
- When you open up Tableau for the first time, you will see a screen with “Connect” in the top left corner. The options below will allow you to import data into the program.
- Since our data is stored in an Excel file, click on Excel under To a file, and then navigate to the file labeled “Tableau Tutorial Data Set.xlsx”
- You should now see a new screen displaying the data that you just imported. This is your Data Source. Here, you can verify that Tableau has correctly imported and interpreted your data.
- The icons above your column names tell you what type of data Tableau thinks that column represents. You will want to verify that Tableau has correctly identified the data types of your variables. Notice that with this dataset, Tableau has incorrectly identified our Date column as text. Click on the data type icon above the column name and select Date to convert this into a date format.
Basics of Setting Up Your Visualization
- Once you are ready to start making visualizations, either click on the Sheet 1 tab or the New Worksheet button at the bottom of the screen.
- On the left side of your screen, you will see the variables from your data set displayed in two different headings: Dimensions (categorical fields) and Measures (quantitative fields).
- From the Dimensions pane, drag the variable Region into Columns at the top of the page. Then from the Measures pane, drag Number of Records into the Rows box. This tells Tableau that you want to create a graph with Region on the horizontal axis, and the number of incidents on the vertical axis. Tableau will automatically choose the type of graph that might work best for your variables.
- Try dragging an additional dimension, say Weapon Type, into Rows. Notice that the vertical axis is now organized by both variables.
- Additional options like colors and sizes can be added by using the Marks box. Drag the variable Weapon Type onto the Color button in the Marks box. This should color the bars by the proportions of the types of weapons used. Drag variables to different buttons in the Marks box to explore what each button does.
- You can explore additional types of visualization tools by referring to the Show Me feature on the right, which will highlight what types of charts you can create with the variables you have selected.
- Try out the different types of graphs by clicking on the images in the Show Me box. Try to see how Tableau shows different variables. Remember that you can always click on the New Worksheet button to open up a new blank tab to work on.
Lesson 1: Scatterplots & Working with Measures
- Suppose that you want to find out if there is a relationship between the numbers of fatalities and injuries in terrorist incidents. From the Measures pane, drag Fatalities to Columns and Wounded to Rows. You should get a “scatterplot” with just one point… Wait, what?
- When you have a variable as a Measure, Tableau automatically tries to aggregate the variable, meaning that it produces one number from a column of data based on an aggregate function. In the bar charts you made above, for example, the height of each bar corresponds to the sum of the incidents.
- Other aggregate functions include the average, maximum, and variance. You can change the aggregate function by clicking on the arrow next to the variable name, which brings down a drop-down menu, and going to Measure.
- To get a scatterplot, you want to disaggregate the data. To disaggregate the data, go to the drop-down menu for the variable in question and click on Dimension. If you want Tableau to disaggregate all measures, go to Analysis on the main menu and uncheck Aggregate Measures.
- Again, you can drag variables to different button in the Marks box to add color, sizes, or labels to the plot.
- In many applications, you may want to add a trend line to the scatterplot to more clearly show the relationship between these two variables. To do this, go to Analysis in the main menu at the top of the screen, hover over Trend Lines, and click on Show Trend Line.
- The Describe Trend Model… option in the Trend Lines menu will allow you to get the linear regression analyses for the line shown.
Lesson 2: Line Charts & Working with Dates
- Starting with a blank sheet, drag the dimension Date to Columns and the measure Number of Records to Rows. Make sure that the Number of Records is aggregated with the Sum function. This will create a line chart of the number of terrorist incidents by year.
- Our line chart is looking a bit sparse. Perhaps we want to look at changes by month instead of by year. Bring down the drop-down menu of the Date variable, and select Month.
- You may have noticed that there are two options labeled Month: the first option will only give us only the month (i.e. May), while the second option will give us both the month and the year (i.e. May 2015). For now, select the latter.
- Like in our other charts, we can vary lines by features such as color and size according to another variable. Drag a dimension to a button in the Marks box to see this.
Lesson 3: Maps & Working with Locations
- Click on the dimension Country in the left pane to select it, and then go to the Show Me feature on the right and click on the option for a Filled map. This will create a map of the countries which appear in our dataset.
- Right now, our map is a bit boring. Add colors by dragging a variable onto the Color button in the Marks box. Do this with Number of Records to show where the world’s terrorist incidents occur.
- Tableau also allows you to create filled maps by subdivisions such as provinces, states, and counties.
- Though filled maps can be useful for aggregating data at the country level, plotting each incident onto the map may be more insightful for our dataset. Though Tableau can use the city of each terrorist incident to plot these points, a list of geographic coordinates is fortunately provided with the dataset.
- Starting with a blank worksheet, drag Longitude to Columns and Latitude to Rows. Remember to disaggregate your measures by selecting Dimension in the drop-down menus of both variables. There should now be a point for each incident in the dataset.
- Drag Fatalities to Size and drag Weapon Type to Color. See if you can spot any patterns. For example, is there a difference between the preferred weapons of the Irish Republican Army in Ireland, Boko Haram in Nigeria, and the New People’s Army in the Philippine Islands?
- Also color points by different variables, such as Attack Type and Target Type.
- A map which changes through time is especially useful with this dataset. Luckily, Tableau makes this option very simple with the Pages box. Drag the dimension Date into this box. This creates a map for each year in the dataset.
- Like in the line chart, we can look at incidents by month instead of by year. Go to the drop-down menu of Date and select Month to do this (make sure that you choose the second option).
- Use the slider to scroll between years or months. Click the play button to animate your map through time.
More Advanced Tips
- Filters: You may want to use a filter if, for example, you only want to see data from one year or within a certain range of years, or if you only want to look at data from one or a few countries. There are two ways to do this:
- Drag your variable in the Filters box to the left of your visualization. A box will pop up allowing you to select the specific values or range of values you see. Click OK to apply your settings.
- Go to the pull down menu for the variable you want to filter by clicking on the small arrow next to the variable name. Choose Show Quick Filter and a filter should appear in the upper right hand corner. Selecting or deselecting values in this box will now automatically update the visualization.
- Groups: Groups are useful for combining variables (i.e. agricultural production for Iowa and Nebraska) or correcting data errors (i.e. grouping IA and Iowa). To create a group, go to the left pane and right-click on the categorical variable that you want to create a group in (i.e. Country) and select Create Group. From there, choose what you want in your group (i.e. United States and Canada).
- You can also select multiple items from your data visualization (by selecting a few points from the scatterplot by clicking while holding Ctrl or dragging a box around them), right-clicking, and then select Group.
- Now that your values are sorted into larger groups, notice that they will appear as new fields in the left pane. Now you can compare the selected values with any other variables or groups that you create.
- Data Display: You can use the Analysis tab on the main menu to change how your data is displayed. For instance, you can change the display from sum of a variable to the percentage of the total. You can also calculate totals and add trend lines to scatterplots under Analysis.
- Dashboards: If you want to make a figure that shows multiple maps or figures, one way is to choose the Dashboard icon at the bottom of the Tableau screen. You can compile multiple sheets, each showing a different map or other diagram, and drag them onto the Dashboard. To export an image of the dashboard, choose Dashboard in the main menu and then Export Image.
Troubleshooting your visualizations
- If you are having trouble creating the visualization you want, make sure your variables are going into the correct boxes above and to the left of your chart:
- Columns, Rows: the variables in these boxes determine where your data appears on the chart horizontally and vertically.
- Pages: this box allows you to create a slideshow scrolling through a specific variable, which is especially useful for seeing trends through time.
- Filters: this box shows what variables are currently being filtered, which restricts specific values from showing up in your chart, allowing you to focus the visualization on a subset of your data.
- Marks: drag a variable onto one of the fields to add useful aesthetics such as colors and labels to your chart.
- Also verify that the data types of your variables are correct: you can always go back to your Data Source in the bottom left corner of the screen if you realize there might be a problem with your data.