Box-and-Whisker Plots

By Jacob White · Published 23 September 2026
graphicsstata

This post will showcase a box plot with whiskers and will provide the code to create the graph within Stata.

This graph contains a dozen box and whisker plots, all with different data sets. When brought together they display a moving average, range and a singular outlier. This graph is effective when handling multiple sets of data than need to be compared with a quick look.

The following code can be used to create this graph.

Note: You will need to download the mylabels user-written command from SSC. To do this simply type ssc install mylabels in your command pane and Stata will install the program for you.

. sysuse nlsw88, clear

. generate wagelog10=log10(wage)

. mylabels 0(10)40 , myscale(log10(@)) local(labels)

. graph hbox wagelog10, over(ind, sort(1)) nooutside ytitle("")
 ylabel(`labels') title("Hourly wage, 1988, woman aged 34-46",
 span) subtitle("") note("Source:1988 data from NLS, U.S. Dept.
 of Labor," "Bureau of Labor Statistics",span)
18 views 0 found this useful