Difference between revisions of "Stata Coding Practices: Visualization"
Line 5: | Line 5: | ||
==Read First== | ==Read First== | ||
Stata graphics | Stata graphics are typically created using one of four command types. Each has specific use cases, strengths, and weaknesses, and it is important to be familiar with the abilities and limitations of each when considering which to use to create a particular visualization. All four methods (except some user-written commands) use the same basic styling syntax discussed in this article. | ||
* The <syntaxhighlight lang="stata" inline>twoway</syntaxhighlight> | * The <syntaxhighlight lang="stata" inline>graph</syntaxhighlight> command suite creates pre-packaged visualizations, typically based on Stata's native <syntaxhighlight lang="stata" inline>collapse</syntaxhighlight> syntax and statistics. | ||
* The <syntaxhighlight lang="stata" inline>twoway</syntaxhighlight> suite, which is the most commonly used tool, allows a flexible and open-ended approach to visualizing any amount of information in an abstract set of axes. | |||
* Built-in graphical commands (such as <syntaxhighlight lang="stata" inline>lowess</syntaxhighlight>) offer pre-packaged visualizations that do not follow the <syntaxhighlight lang="stata" inline>graph</syntaxhighlight> style. These commands are typically better used within a <syntaxhighlight lang="stata" inline>twoway</syntaxhighlight> environment and may behave differently when used independently. | |||
* User-written commands (such as <syntaxhighlight lang="stata" inline>iegraph</syntaxhighlight> or <syntaxhighlight lang="stata" inline>spmap</syntaxhighlight>) create custom visualizations, but typically have unique purpose-built syntaxes and cannot be integrated in a <syntaxhighlight lang="stata" inline>twoway</syntaxhighlight> environment. | |||
==Graphics Options== | ==Graphics Options== |
Revision as of 19:42, 9 November 2020
(This page is under construction.)
Modern Stata versions have extremely powerful graphics capabilities which allow the rapid creation of publication-quality graphics from almost any kind of tabular data. Although the default graphical commands and settings leave much to be desired, the customizability and interoperability of Stata's visualization tools mean that almost any imaginable output can be rendered using Stata's built-in graphics engine.
Read First
Stata graphics are typically created using one of four command types. Each has specific use cases, strengths, and weaknesses, and it is important to be familiar with the abilities and limitations of each when considering which to use to create a particular visualization. All four methods (except some user-written commands) use the same basic styling syntax discussed in this article.
- The
graph
command suite creates pre-packaged visualizations, typically based on Stata's nativecollapse
syntax and statistics. - The
twoway
suite, which is the most commonly used tool, allows a flexible and open-ended approach to visualizing any amount of information in an abstract set of axes. - Built-in graphical commands (such as
lowess
) offer pre-packaged visualizations that do not follow thegraph
style. These commands are typically better used within atwoway
environment and may behave differently when used independently. - User-written commands (such as
iegraph
orspmap
) create custom visualizations, but typically have unique purpose-built syntaxes and cannot be integrated in atwoway
environment.
Graphics Options
local bad BAD
sysuse auto`bad'.dta