Create XY Scatter Chart with Tableau Public

Just to remind you, scatter charts plot two variables against each other, on x- and y-axis, revealing possible correlations. With Tableau Public, you can create an interactive scatter chart, letting users hover over points to view specific details.

Figure 5.35 illustrates a strong relationship between Connecticut school district income and test scores.

Figure 5.35: This scatterplot is made in Tableau Public an shows the relationship between household income and test scores in Connecticut school districts.

Install Tableau and Get Data

You can download Tableau Public for Windows or Mac from Tableau’s official website. You will need to provide your email address.

If you wish to use the dataset from the scatter plot in Figure 5.35, you can download the sample Excel file. This data file consists of three columns: district, median household income, and grade levels (above/below national average for 6th grade Math and English test scores). The Notes tab explains how this data is based on the work of Sean Reardon et al. at the Stanford Education Data Archive, Motoko Rich et al. at The New York Times, Andrew Ba Tran at TrendCT, and the American Community Survey 2009-13 via Social Explorer.

Connect Data and Create a Scatterplot

Tableau Public’s welcome page includes three sections: Connect, Open, and Discover.

  1. Under Connect, choose Microsoft Excel if you decided to use the sample dataset or your own Excel file. To load a CSV file, choose Text file. If your data is in Google Sheets, click More… and choose Google Sheets. Once you successfully connect to your data source, you will see it under Connections in the Data Source tab. Under Sheets, you will see two tables, data and notes.

  2. Drag data sheet into Drag tables here area, like is shown in Figure 5.36. You will see the preview of the table under the drag-and-drop area. You have successfully connected one data source to Tableau Public, and you are ready to build your first chart.

Drag data sheet into Drag tables here area.

Figure 5.36: Drag data sheet into Drag tables here area.

  1. Go to Sheet 1 tab (in the lower-left corner of the window) to view your worksheet. Although it may feel overwhelming at first, the key is learning where to drag items from the Data pane (left) into the main worksheet. Tableau marks all data fields as blue (discrete values, mostly text fields or numeric labels) or green (continuous values, mostly numbers).

  2. Drag the Grade Levels field into the Rows field above the charting area, which for now is just empty space. You can consult Figure 5.37 for this and two following steps. Tableau will apply a summation function to it, and you will see the SUM(Grade Levels) appearing in the Rows row, and a blue bar in the charting area. It makes little sense so far, so let’s plot another data field.

  3. Drag Median Household Income to the Columns field (just above the Rows field). Tableau will once again apply the summation function, so you will see SUM(Median Household Income) in the Columns. The bar chart will transform into a scatter chart with just one data point in the upper-right corner. That is because the data for both is aggregated (remember the SUM function).

  4. We want to tell Tableau to disaggregate the household and grade levels variables. To do so, drag District dimension into the Detail box of the Marks card. You will now see a real scatter chart in the charting area. If you hover over points, you will see all three values associated with it.

Drag data fields to the right places in Tableau.

Figure 5.37: Drag data fields to the right places in Tableau.

Add Title and Caption, and Publish

Give your scatter chart a meaningful title by double-clicking on default Sheet 1 title above the charting area.

You will normally need to provide additional information about the chart, such as source of the data, who built the visualization and when, and other important things. You can do so inside a Caption, a text block that accompanies your Tableau visualization. In the menu, go to Worksheet > Show Caption. Double-click the Caption block that appeared, and edit the text.

As a result, your final worksheet will look like shown in Figure 5.38.

This scatter chart is ready to be published.

Figure 5.38: This scatter chart is ready to be published.

Tip: In the dropdown above Columns section, change Standard to Fit Width to ensure your chart occupies 100% of available horizontal space.

To publish the chart to the web,

  1. Go to File > Save to Tableau Public As…. A window to sign in to your account will pop up. If you don’t have an account, click Create one now for free at the bottom.

  2. Once signed in, a window to set the workbook title will appear. Change the default Book1 title to something meaningful, as this name will appear in the URL for your published work. Click Save.

  3. Once the dashboard is saved, Tableau Public will open up a window in your default browser with the visualization. In the green ribbon above the chart, click Edit Details to edit the title or description. Under Toolbar Settings, see checkbox to Allow others to download or explore and copy this workbook and its data (Figure 5.39), and enable/disable it as you think is appropriate. As advocates for open and accessible data, we recommend leaving the box checked.

This scatter chart is ready to be published.

Figure 5.39: This scatter chart is ready to be published.

See the Embed Tableau Public on Your Website section of this book to insert the interactive version of your chart on a web page that you control.

Tip: Your entire portfolio of Tableau Public visualizations is online at https://public.tableau.com/profile/USERNAME, where USERNAME is your unique username.

To learn more, see Tableau Public resources page.