css.php

Simple Restaurant Visualizations (2)

A Simple Restaurant Visualization

Link to Simple Restaurant Visualizations Video

Data Visualization and Design | CUNY Graduate Center | Summer 2019

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.

Goals

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

Data

You have already cleaned this dataset in the previous tutorial

Restaurant Recomendations DHUM 7300

Steps

Scatter Plots

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.

  1. Select the ‘New Worksheet’ icon at the bottom of the page
  2. Drag Sheet 1 and make sure you have the right Form Responses activated – you want the one that was joined.
  3. 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.
  4. Drag the Food Rating to the Rows (which is the y-axis or Dependent Variable)
  5. Drag the Ambiance Rating, Service Rating, and Yelp Rating to the Columns (the x-axis, or Independent Variable)
  6. 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

  1. Drag the details pill onto the Tooltips Marks card
  2. Click on Tooltips and a dialog box will appear.
  3. Remove the Ratings (since these can be read in the chart)
  4. Remove the REstaurant: since it is implied, make the name of the restaurant 12 point font and bold faced
  5. 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.

Maps

Which borough has the most recommended restaurants according to our dataset?

Begin by watching this video

  1. 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.
  2. 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.
  3. 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).
  4. 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.
  5. Great, this gives us a centroid for each borough (since we didn’t actually georeference our restaurants – just the borough).
  6. 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.
  7. 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.
  8. 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.
  9. Finally, to color the polygons based on how many restaurants are in the borough, drag the ‘CNTD Restaurants’ pill onto the ‘Color’ card.
  10. Give your map a title
  11. 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.

Pie Chart

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.

  1. Make a New Worksheet
  2. Select ‘Pie’ in the Marks Card
  3. Drag the ‘First Name’ Pill onto the Color Card and the ‘CNTD Restaurants’ onto the Ange Card. You have a Bar Chart!
  4. You may want to select ‘Entire View’ from the dropdown at the top of the page.
  5. To show the percentages for each slice, right-click on CNTD Restaurant and select Quick Table Calculation > Percent of Total.
  6. Click on Label on the Marks card and select Show mark labels.
  7. Give your chart a title
  8. Name your sheet ‘Pie Chart’

Bar Chart

Now we want to know what each person’s average rating was.

  1. Make a New Worksheet
  2. Select ‘Create a New Calculated Field’ from the Dimensions Column
  3. Enter this Formula: ([Ambiance Rating] + [Food Rating] + [Service Rating])/3 and call it ‘Average Rating’
  4. Drag the ‘First Name’ Pill to Columns and the ‘Average Rating’ Pill to the Rows. Those numbers are very large – what happened?
  5. 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.
  6. Remove the Null Values since they are only present to make our map complete.
  7. 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.
  8. Give your Chart a title
  9. Name your sheet ‘Bar Chart’

Line 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.

  1. Make a New Worksheet
  2. Drag the Timestamp to the ‘Columns’, and the CONTD Restaurants to the Rows
  3. If your Timestamp is by year, change it to be by Day (or by hour, again, this depends on what you want to know.)
  4. Change the title
  5. Name the sheet ‘Line chart’
  6. 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.

Need help with the Commons? Visit our
help page
Send us a message
Skip to toolbar