[Stata] Graph: How to customize graph styles in STATA
How to change graph style
You can change the scheme of the graph using the following command before running the command for plotting.
set scheme stylename
If you want the scheme lean1 to be the default scheme, you can change it by using the following command.
set scheme stylename, perm
lean
scheme
If you install lean1
and lean2
scheme, it offers a scheme that is black and white, suitable for publishable style graphs.
search lean1
Since it’s not on ssc archive, you need to install it by searching it. After installation, you can not set the scheme as follows.
set scheme lean1
The only difference between lean1
and lean2
is the auxiliary line.
plotplain
scheme
ssc install blindschemes, replace
set scheme plotplain
Another user-created scheme, plotplain, also offers a great publishable style graph with auxiliary lines on the x- and y-axis.
set scheme plotplainblind
The plotplainblid option shows the graph that is not filled like this.
cleanplots
scheme
The cleanplots is a Stata graphics scheme that has recently been developed based on plotplain
with more updates for the design. Please check the author’s website for the difference between cleanplots
and plotplain
: https://www.trentonmize.com/software/cleanplots
ssc install cleanplots
set scheme cleanplots
schemepack
: Graph styles like ggplot in R
One of the major updates of STATA version 18 is the graph styles, which are more similar to ggplot
in R. If you use a lower version of STATA or would love to try different styles, Dr. Naqvi has developed a fantastic user-created command! It is really simple to use, just two lines of code.
ssc install schemepack, replace // instsall package
set scheme gg_tableau // set schemed that you would love to use
You can browse a lot of options here in the developer’s GitHub: https://github.com/asjadnaqvi/stata-schemepack
My recommendations are 1) cblind1 (color-blind friendly), 2) gg_tableau (similar to ggplot graphs), 3) white_tableau (similar to STATA 18 updated scheme), and 4) white_hue. You can see what you like the most and then just set it up with a single line of code: set scheme schemename
.