Skip to Main Content

Stata: Graphing

Graphics in Stata

Stata has powerful graphing capabilities, which can be controlled by command just like everything else in Stata. However, you can learn a lot by using the menu options and then paying attention to the commands that show up in the results window.

The following graphs are created using data from the Importing and Exploring Data lesson.

Scatter plots

The scatter plot is useful when you have two numeric variables.

twoway (scatter incwage age if occ2010==2310, sort mcolor(teal) msize(small) ) (lfit incwage age if occ2010==2310)

Histogram

The histogram allows you to visualize the distribution of a single variable. It's a great way to see at a glance if your variable really contains what you think it contains.

histogram age, width(10) frequency fcolor(dimgray) lcolor(gray)

Line chart

For a line chart you'll want a time series, so let's import Maine's unemployment rate from Federal Reserve Economic Data.

import fred MEUR, daterange(2006-09-01 2016-08-29) aggregate(monthly,avg) clear
twoway line MEUR daten