Mastering Two-Way Scatter Plots in Stata

Joan Jul 01, 2026

In the realm of data analysis, visualizing relationships between variables is crucial. Stata, a powerful statistical software, offers a robust tool for this: the two-way scatter plot. This graphical representation allows you to explore and understand the relationship between two continuous variables, making it an invaluable asset for data exploration and model diagnostics.

a book cover with the title whounit? using data and scatterplots to solve a mystery
a book cover with the title whounit? using data and scatterplots to solve a mystery

Before delving into the intricacies of creating a two-way scatter plot in Stata, it's essential to understand the basics. A two-way scatter plot, also known as an X-Y plot, displays the values of one variable (Y) on the vertical axis and the values of another variable (X) on the horizontal axis. Each data point represents a unique observation in your dataset.

Scatterplots and Data Math Blog
Scatterplots and Data Math Blog

Creating a Two-Way Scatter Plot in Stata

Stata provides a simple and intuitive command to generate a two-way scatter plot. The command is `twoway scatter`, and it's used as follows:

two way scatter plot in stata
two way scatter plot in stata

`twoway scatter yvar xvar, msize(msize) mcolor(mcolor) title("Title")`

Specifying Variables

Scatter plot in R studio
Scatter plot in R studio

The `yvar` and `xvar` options specify the variables to be plotted on the Y and X axes, respectively. These should be continuous variables, as Stata cannot plot categorical or string variables using the `twoway scatter` command.

For instance, if you want to plot the relationship between `height` and `weight` variables, your command would look like this:

`twoway scatter weight height`

High School Scatter Plots: Correlation Worksheet
High School Scatter Plots: Correlation Worksheet

Customizing the Plot

Stata allows you to customize your scatter plot to better suit your needs. The `msize` option determines the size of the markers, while `mcolor` sets the color. You can also add a title to your plot using the `title()` option.

Here's an example that includes these customizations:

Scatter Plot Maker Excel | Scatter Diagram | Correlation Analysis
Scatter Plot Maker Excel | Scatter Diagram | Correlation Analysis

`twoway scatter weight height, msize(medium) mcolor(blue) title("Relationship between Weight and Height")`

Interpreting and Analyzing Scatter Plots

How to Make a Polygon Scatter Plot in Tableau
How to Make a Polygon Scatter Plot in Tableau
Create a Scatter Plot with Matplotlib
Create a Scatter Plot with Matplotlib
How to Make a Scatter Plot in Excel and Present Your Data
How to Make a Scatter Plot in Excel and Present Your Data
11 Hands-On Scatter Plot Activities (Free PDF Downloads)
11 Hands-On Scatter Plot Activities (Free PDF Downloads)
Scatter Plot Associations Anchor Chart
Scatter Plot Associations Anchor Chart
Simply creating various scatter plots with ggplot #rstats | R-bloggers
Simply creating various scatter plots with ggplot #rstats | R-bloggers
3 Steps to Master Scatter Plots in the Classroom
3 Steps to Master Scatter Plots in the Classroom
A Detailed Guide to the ggplot Scatter Plot in R
A Detailed Guide to the ggplot Scatter Plot in R
seaborn.scatterplot — seaborn 0.13.2 documentation
seaborn.scatterplot — seaborn 0.13.2 documentation
Construct and Interpret Real World Scatter Plots Worksheets
Construct and Interpret Real World Scatter Plots Worksheets
Scatter Plots
Scatter Plots
Scatter Plot Worksheet
Scatter Plot Worksheet
Scatter Diagram
Scatter Diagram
Scatterplots and Correlation
Scatterplots and Correlation
Scatter (XY) Plots
Scatter (XY) Plots
Scatter Plot
Scatter Plot
Exporting nice plots from R
Exporting nice plots from R
Scatter Plot Project with Real World Sports Data
Scatter Plot Project with Real World Sports Data
Scatter (XY) Plots
Scatter (XY) Plots
Create Dynamic Scatter Plots with Plotly Animation
Create Dynamic Scatter Plots with Plotly Animation

Once you've created your scatter plot, it's time to interpret and analyze the relationship between your variables. The shape of the data points can reveal a lot about the relationship between the variables.

Linear Relationships

A linear relationship exists when the data points form a straight line. Stata can help you determine the strength and direction of this relationship using the `regress` command, which performs a linear regression analysis.

For example, to perform a linear regression of `weight` on `height`, you would use the following command:

`regress weight height`

Non-Linear Relationships

Sometimes, the relationship between variables is not linear. In such cases, Stata offers several options for fitting non-linear curves to your data. The `twoway fit` command can be used to fit various types of curves, including polynomials, exponentials, and logarithms.

Here's an example of fitting a quadratic curve to the relationship between `weight` and `height`:

`twoway fit weight height, fit(quadratic)`

In conclusion, the two-way scatter plot is a powerful tool in Stata that allows you to visualize and understand the relationship between two continuous variables. Whether you're exploring data, performing model diagnostics, or communicating your findings, mastering the `twoway scatter` command is a must. So, start exploring the relationship in your data today!