A note on creating inset plots using graph twoway

Matthew Tibbles, Eric Melse

Research output: Contribution to journalComment/Letter to the editorAcademic


Inset plots can be used to “zoom in” on densely populated areas of a graph or to add extra relevant data in the form of, for example, distribution plots. However, the standard Stata command for combining plots, graph combine, does not permit this type of seamless integration. Each plot within a graph combine object is allocated a grid cell that cannot be placed within another grid cell— at least not without certain (invariably unwanted) graphical complications. We present a fairly simple work-around to this issue using reproducible examples. The main idea is to plot insets along a second axis and then artificially modify the range of this axis to constrain the inset plot within a specified area of the main graph. Additional tips are included for producing more intricate, multilayered inset graphs.

Original languageEnglish
Pages (from-to)265-275
JournalThe Stata Journal
Issue number1
Publication statusPublished - Mar 2023


Dive into the research topics of 'A note on creating inset plots using graph twoway'. Together they form a unique fingerprint.

Cite this