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.
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.
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,
datasheet 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.
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).
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.
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
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.