KNOWLEDGE BASE

Drawing a Rectangle Area on Scatter Plot Chart


Published: 28 Jun 2017
Last Modified Date: 30 Jun 2017

Question

How to draw a rectangle area in a Scatter Plot Chart. 

Environment

Tableau Desktop

Answer

CLICK TO EXPAND STEPS
Option 1 - You are unable to modify the data source
Follow the below steps if you are unable to modify your data source

Step 1: Data Preparation

To build a rectangle area on a Scatter Plot Chart, you can use the Union function from the Data Source pane to join your Excel Sheets if they cannot be joined by a same dimension: .
For example, assuming your Excel data source is shaped in the following format:
Sheet 1 "POINT" in Excel
IDXpointYpointSize
10134919
1023369
1033286
1042217
1053166
Sheet 2 "AREA" in Excel
IDXareaYarea
111
214
344
441

Step 2: Union the Excel sheets

  1. Using the above specific example in an excel file, please connect Tableau Desktop to the file. 
  2. From the data source menu, drag the "POINT" sheet to the blank data source pane. 
  3. Then, drag the "AREA" on top of it. 
  4. You will notice that all rows from both sheets are available

Step 3: Build the View

  1. Right click Path and select Convert to Dimension.
  2. Drag Xarea and Xpoint to Columns.
  3. Drag Yarea and Ypoint to Rows
  4. In the Marks card, select the SUM(Xarea) mark and change the Chart type to Polygon
  5. In the SUM(Xarea) mark card, drag Path to Path 
  6. In the SUM(Xpoint) mark card, drag ID to Text 
  7. Right click SUM(Xpoint) and select Dual Axis
  8. Right click SUM(Ypoint) and select Dual Axis
  9. Per Mark card, adjust colors and transparency as desired.
To view the steps showed in the below video, please expand the above section.
Note: the video has no sound.
 
CLICK TO EXPAND STEPS
Option 2 - You can modify the data source
Follow the below steps if you have the ability to modify your data source.

Step 1: Data Preparation

To build a rectangle area on a Scatter Plot Chart, your data needs to be shaped in a specific way. An example of how the data could be shaped in Excel below: 
 
Sheet 1 "POINT" in Excel
IDXpointYpointSize
10134919
1023369
1033286
1042217
1053166
1   
2   
3   
4   
Sheet 2 "AREA" in Excel
IDXareaYarea
111
214
344
441
Sheet 2 "AREA" in Excel
IDXareaYarea
111
214
344
441

Step 2: Connect to/join the data

  1. Using the above specific example in an excel file, please connect Tableau Desktop to the file. 
  2. From the data source menu, drag the "POINT" sheet to the blank data source pane. 
  3. Then, drag the "AREA" sheet next to it. 
  4. Choose a Left join. 

Step 3: Build the View

  1. Drag Xarea and Xpoint to Columns.
  2. Right click SUM(Xpoint) and select Dual Axis
  3. Drag Yarea and Ypoint to Rows
  4. Right click SUM(Ypoint) and select Dual Axis
  5. In the Marks card, drag ID to Detail on the All mark. 
  6. In the Marks card, select the SUM(Xarea) mark and change the Chart type to Polygon
  7. Remove Measure names from this Mark card. 
  8. In the Marks card, select the SUM(Xpoint) mark and add "Size" to Size.
  9. Click the All mark card again and adjust color and transparency as desired.
To view the steps showed in the below video, please expand the above section.
Note: the video has no sound.
 
Did this article resolve the issue?