University of Southern California

ITS Information Technology Services

A division of the Office of the Chief Information Officer

Stata Graphics

Making a Scatter Plot

One of the most commonly used types of Stata graphs is a scatter plot. This plots the values of two variables against each other. In the example below, data from a clinical trial are used. The patient's age at the start of the experiment (the X variable) is plotted against the months of survival.

Stata Graph 1. From the Stata menu, select Graphics, then select Two-way Graph. A pop-up window will appear with several tabs. If you want any titles or captions, click on the Titles tab in the fill those in now. To label the X axis, add a reference line at a particular point, use a logarithmic scale, or other specifications for the X axis, click on the X axis tab. To customize the Y axis, click the Y axis tab.

Graph Window 1

2. Click on the Create button. The window shown below will pop up. For a scatter plot, such as the one shown above, select Scatter in the window on the right. Either type the Y variable in the designated box or select it from the drop-down menu using the blue arrows to the right of the box. Click the box next to Sort on X variable. Having the data in order on the X axis will make your chart easier to read and interpret. Click the Submit button and your Stata graph will appear.

Graph Window 2

Last updated:
December 08, 2008

Stata

The use of all USC computing resources is governed by the USC Computing Policies.