Tableau Scatter Plot is useful to visualize the relationship between any two sets of data. In this article, we will show you how to Create a Scatter Plot in Tableau with an example. For this scatter plot in Tableau example, we write a custom SQL query.
-- SQL Query to create a Scatter Plot in Tableau SELECT Geo.EnglishCountryRegionName, Geo.StateProvinceName, Geo.City, Geo.PostalCode, Fact.OrderQuantity, Fact.TotalProductCost, Fact.SalesAmount, Fact.TaxAmt, Fact.OrderDate FROM FactInternetSales AS Fact INNER JOIN DimCustomer AS Cust ON Fact.CustomerKey = Cust.CustomerKey INNER JOIN DimGeography AS Geo ON Cust.GeographyKey = Geo.GeographyKey
How to Create a Scatter Plot in Tableau
To create a Scatter plot in Tableau, drag and drop the Order Quantity from Measures Region to Rows Shelf and Sales Amount from Measures region to Columns Shelf. The Tableau intelligence will automatically select the scatter plot, and if it does not, please select the Scatter plot option from the Show Me window.
As you see that it is showing the aggregated data. But, we require to see the detailed information. So, let me drag and drop the Postal Code from Dimensions Region to Details field present in Marks Shelf.
Add Linear Progression to Scatter Plot in Tableau
This example shows how to add the linear progression to the scatter plot. The Tableau provides two different ways to add linear progression.
First Approach: You can add the progression, or Trend lines using the Trend Line option available in the Tableau. To access this option, Please navigate to the Analytics tab.
Next, Drag and drop the Tableau Trend Line to the Plotting area.
Second Approach: Right-click on the Plotting area and select the Trend Lines, and click on the Show Trend Lines option.
Once you click on the Show Trend Lines option, Tableau scatter plot will show the Trendline, along with the confidence bands.
By default, Tableau will add the confidence bands to the Trendline, but you can alter these default settings. To do so, right-click on the Plotting area and select the Trend Lines, and click on the Edit Trend Lines …option.
It will open a new window called the Trend Lines Options. Here you can change the default Linear Model to Logarithmic, Exponential, Polynomial, etc. Here, we will remove the Confidence bars. To do this, please uncheck the Show Confidence bands option.
It removes the Tableau confidence bars
Remove Scatter Plot Trend Line
Right-click on the Plotting area will open the context menu. Please select the Trend Lines, and uncheck the Show Trend Lines option.
Add Colors to Scatter Plot
This example shows how to add colors to the Tableau scatter plot. For this, drag and drop the English Country Region Name from Dimensions Region to Color field in Marks Shelf. It means each country has its own color
Add Multiple Trend Lines to a Scatter Plot in Tableau
This example shows how to add the trend line for each region in a scatter plot. Right-click on the Plotting area will open the context menu. Please select the Trend Lines, and click on the Show Trend Lines option.
It will create the Tableau Trend Line for each country.
Change the Size of a Scatter Plot
Let me show you how to change the size of a dot. For this, drag and drop the English Country Region Name from Dimensions Region to Size field in the Marks Shelf, as shown below. It means each country has its own size
Change the Scatter Plot Shape of a ring
To change the Tableau scatter plot default ring shape, click on the Shape field in Marks Shelf. It will open the list of available shapes. Please select the required shape.
We changed the default ring shape to star
Create Category wise Scatter Plot
To create a Tableau scatter plot for each region, drag the English Country Region Name from Dimensions Region to Rows Shelf.
Add Labels to a Scatter Plot
It shows how to add labels to each dot in a Tableau scatter plot. For this, drag and drop the Order Quantity from the Measures Region to Label field in Marks Shelf.