This tutorial will show you how to make a scatterplot, map, pie chart, bar chart, and line chart. It will also help you become comfortable will Dimensions and Measures as well as Pills and Cards. These visualizations types are the basic tools you will work with. However, like any tool, having it and using it responsibly are different things. We will spend the rest of the semester refining how we manipulate our data and enhance these core visualizations to answer questions and tell clear and compelling stories will data visualization.
By the end of this tutorial, you will be able to: * Make simple visualizations in Tableau to answer questions about a dataset * Transform variables between Dimensions and Measures * Work with both categorical and numeric data appropriately * Make a chloropleth map, pie chart, scatter plot, line chart, and bar chart
You have already cleaned this dataset in the previous tutorial
Begin by watching this video on Pill Types.
First we want to know the relationship between the Food Rating, and the Service, Ambiance, and Yelp ratings.
- Select the ‘New Worksheet’ icon at the bottom of the page
- Drag Sheet 1 and make sure you have the right Form Responses activated – you want the one that was joined.
- Drag the ‘Restaurant’ to the Marks box. If we don’t do this, Tableau will plot only the sum of each variable. This changes the GRANULARITY. You will work with this a lot this semester. You may want to watch this video before moving on. It is not essential to complete this lab, but will give you a better view of how granularity works in Tableau.
- Drag the Food Rating to the Rows (which is the y-axis or Dependent Variable)
- Drag the Ambiance Rating, Service Rating, and Yelp Rating to the Columns (the x-axis, or Independent Variable)
- Change the Title by clicking on it and giving a new title
Add a tooltip to get more details about the restaurants, i.e., the user reviews
- Drag the details pill onto the Tooltips Marks card
- Click on Tooltips and a dialog box will appear.
- Remove the Ratings (since these can be read in the chart)
- Remove the REstaurant: since it is implied, make the name of the restaurant 12 point font and bold faced
- Change ‘Details’ to ‘Review’
You can embed urls and almost any data you want in the tooltips.
Now you will need to make a new work sheet. Follow these same steps, but choose different variables to answer a different question. Maybe you want to see the relationship between Yelp Rating and Food, Service, Ambiance. Or maybe you want to ask questions about the Respondents instead of the Restaurants. You will include THIS Plot in your Dashboard.
Which borough has the most recommended restaurants according to our dataset?
Begin by watching this video
- We have Latitude and Longitude in our dataset, but there is also a Lat/Lon that Tableau calculated for use using “Brooklyn” as a city name, which did not work. See the video for an illustration.
- Check to make sure that your Latitude and Longitude have the correct Geographic Role by clicking on the down arrow >> Geographic Role >> Latitude & Longitude, respectively.
- Check to make sure your borough has the correct Geographic Role (it’s in Dimensions). It’s likely that Borough is listed as a City rather than a County. Also change ‘Borough Name’ to have a Geographic Role (also County).
- Tableau is quite smart and as long as the Geographic Role is set, it will give you a map. Drag your ‘Longitude’ to the Columns and ‘Latitude’ to the Rows.
- Great, this gives us a centroid for each borough (since we didn’t actually georeference our restaurants – just the borough).
- Now we need to ask about the Restaurants, but Restaurant is a Dimension, not a Measure and therefore we cannot perform calculations on it. To change this, drag it to the ‘Measures’ Section, this will create a copy that behaves as a Measure and therefore can be counted, etc.
- Drag ‘CNTD Restaurants’ onto the Marks Card. Now if you click on one of the dots on your map, you should see how many restaurants are located at that dot.
- Now we will visualize by borough. Drag the Borough Name pill to the marks card. If you drag ‘Borough’, only the boroughs that exist in the dataset will be shown.
- Finally, to color the polygons based on how many restaurants are in the borough, drag the ‘CNTD Restaurants’ pill onto the ‘Color’ card.
- Give your map a title
- Name your sheet ‘Map’
As you can see, borough visualizations are actually not that great. More often than not, you may want to aggregate by census tract, neighborhood, state, or country, depending on your project. If we really wanted to show the location of the restaurants, we would do the work to recover the lat/lon and NOT aggregate at the borough level. However, for purposes of demonstration, we will end here.
We would also like to know who contributed the most responses and their average rating across the variables. We’ll answer this with a bar chart.
- Make a New Worksheet
- Select ‘Pie’ in the Marks Card
- Drag the ‘First Name’ Pill onto the Color Card and the ‘CNTD Restaurants’ onto the Ange Card. You have a Bar Chart!
- You may want to select ‘Entire View’ from the dropdown at the top of the page.
- To show the percentages for each slice, right-click on CNTD Restaurant and select Quick Table Calculation > Percent of Total.
- Click on Label on the Marks card and select Show mark labels.
- Give your chart a title
- Name your sheet ‘Pie Chart’
Now we want to know what each person’s average rating was.
- Make a New Worksheet
- Select ‘Create a New Calculated Field’ from the Dimensions Column
- Enter this Formula: ([Ambiance Rating] + [Food Rating] + [Service Rating])/3 and call it ‘Average Rating’
- Drag the ‘First Name’ Pill to Columns and the ‘Average Rating’ Pill to the Rows. Those numbers are very large – what happened?
- Change the aggregation of the Average Rating by selecting the menu arrow and changing the value to ‘Average’. Now it is the Average of the Averages.
- Remove the Null Values since they are only present to make our map complete.
- Currently the values are in alphabetical order. Most often, it makes sense to order your columns based on the value rather than alphabetically (there are some exceptions of course). Do this by clicking the order button at the top of the page.
- Give your Chart a title
- Name your sheet ‘Bar Chart’
We also have some interesting metadata in this dataset that illustrates how many people answered on each day or at a given hour of the day. We’d like to know when most people where answering the survey. We can make a line chart to illustrate that.
- Make a New Worksheet
- Drag the Timestamp to the ‘Columns’, and the CONTD Restaurants to the Rows
- If your Timestamp is by year, change it to be by Day (or by hour, again, this depends on what you want to know.)
- Change the title
- Name the sheet ‘Line chart’
- Name your sheets
Congratulations!! You have made your first 5 visualizations. What we’ve covered today will form the foundation for everything we do in this course. Ultimately, all visualizations fall into a few different types, dependent upon your data types and research questions.
Move on to the next video to transform these into a Dashboard.
Tutorial written by Michelle McSweeney, PhD for Introduction to Data Visualization, a course in the M.A. in Digital Humanities at the Graduate Center at CUNY. More information about the program is available here.