SlideShare a Scribd company logo
1 of 1
Download to read offline
Laura Hughes (lhughes@usaid.gov) • Tim Essam (tessam@usaid.gov)
follow us @flaneuseks and @StataRGIS
inspired by RStudio’s awesome Cheat Sheets (rstudio.com/resources/cheatsheets) updated June 2016
CC BY 4.0
geocenter.github.io/StataTraining
Disclaimer: we are not affiliated with Stata. But we like it.
SYMBOLS TEXTLINES / BORDERS
xlabel(#10, tposition(crossing))
number of tick marks, position (outside | crossing | inside)
tick marks
legend
line tick marks
grid lines
axes
<line options>
xline(...)
yline(...)
xscale(...)
yscale(...)
legend(region(...))
xlabel(...)
ylabel(...)
<marker
options>
marker axis labels
legend
xlabel(...)
ylabel(...)
legend(...)
title(...)
subtitle(...)
xtitle(...)
ytitle(...)
titles
text(...)
<marker
options>
marker label
annotation
jitter(#)
randomly displace the markers
jitterseed(#)
marker arguments for the plot
objects (in green) go in the
options portion of these
commands (in orange)
<marker
options>
mcolor(none)mcolor("145 168 208")
specify the fill and stroke of the marker
in RGB or with a Stata color
mfcolor("145 168 208") mfcolor(none)
specify the fill of the marker
lcolor("145 168 208")
specify the stroke color of the line or border
lcolor(none)
mlcolor("145 168 208")
glcolor("145 168 208")
tlcolor("145 168 208")
marker
grid lines
tick marks
mlabcolor("145 168 208")
labcolor("145 168 208")
specify the color of the text
color("145 168 208") color(none)
axis labels
marker label
ehuge
vhuge
huge
vlarge
large
medlarge
medium
medsmall
tiny
vtiny
vsmall
small
msize(medium) specify the marker size:
huge20 pt.
vhuge
28 pt.
16 pt. vlarge
14 pt. large
12 pt. medlarge
11 pt. medium
1.3 pt. third_tiny
1 pt. quarter_tiny
1 pt minuscule
half_tiny2 pt.
tiny4 pt.
vsmall6 pt.
10 pt. medsmall
8 pt. small
mlabsize(medsmall)
specify the size of the text:
labsize(medsmall)
size(medsmall)
axis labels
marker label
vvvthick medthin
vvthick thin
medium none
vthick vthin
medthick vvvthin
thick vvthin
lwidth(medthick)
specify the thickness
(stroke) of a line:
mlwidth(thin)
glwidth(thin)
tlwidth(thin)
marker
grid lines
tick marks
label location relative to marker (clock position: 0 – 12)
mlabposition(5)marker label
POSITION
msymbol(Dh) specify the marker symbol:
O
o
oh
Oh
+
D
d
dh
Dh
X
T
t
th
Th
p i
S
s
sh
Sh
none
format(%12.2f )
change the format of the axis labels
axis labels
nolabels
no axis labels
axis labels
mlabel(foreign)
label the points with the values
of the foreign variable
marker label
off
turn off legend
legend
label(# "label")
change legend label text
legend
glpattern(dash)
solid longdash longdash_dot
dot dash_dot blank
dash shortdash shortdash_dot
lpattern(dash)
grid lines
line axes specify the
line pattern
tlength(2)tick marks
nogmin nogmax
offaxesnoline
nogrid
noticks
axes
grid lines
tick marks
no axis/labels
set seed
for example:
scatter price mpg, xline(20, lwidth(vthick))
SYNTAXSIZE/THICKNESSSAPPEARANCECOLOR
Plotting in Stata 14.1
Customizing Appearance
For more info see Stata’s reference manual (stata.com)
Schemes are sets of graphical parameters, so you don’t
have to specify the look of the graphs every time.
Apply Themes
adopath ++ "~/<location>/StataThemes"
set path of the folder (StataThemes) where custom
.scheme files are saved
net inst brewscheme, from("https://wbuchanan.github.io/brewscheme/") replace
install William Buchanan’s package to generate custom
schemes and color palettes (including ColorBrewer)
twoway scatter mpg price, scheme(customTheme)
USING A SAVED THEME
help scheme entries
see all options for setting scheme properties
Create custom themes by
saving options in a .scheme file
set scheme customTheme, permanently
change the theme
set as default scheme
twoway scatter mpg price, play(graphEditorTheme)
USING THE GRAPH EDITOR
Select the
Graph Editor
Click
Record
Double click on
symbols and areas
on plot, or regions
on sidebar to
customize
Save theme
as a .grec file
Unclick
Record
1
2
3
4
5
6
7
8
9
10
050100150200
y-axistitle
0 20 40 60 80 100
x-axis title
y2
Fitted values
subtitle
title
legend
x-axis
y-axis
y-line
y-axis title
y-axis labels
titles
marker label
line
marker
tick marks
grid lines
annotation
plots contain many features
ANATOMY OF A PLOT
scatter price mpg, graphregion(fcolor("192 192 192") ifcolor("208 208 208"))
specify the fill of the background in RGB or with a Stata color
scatter price mpg, plotregion(fcolor("224 224 224") ifcolor("240 240 240"))
specify the fill of the plot background in RGB or with a Stata color
outer region inner region
inner plot region
graph region
inner graph region
plot region
Save Plots
graph twoway scatter y x, saving("myPlot.gph") replace
save the graph when drawing
graph save "myPlot.gph", replace
save current graph to disk
graph export "myPlot.pdf", as(.pdf)
export the current graph as an image file
graph combine plot1.gph plot2.gph...
combine 2+ saved graphs into a single plot
see options to set
size and resolution

More Related Content

Recently uploaded

Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryJeremy Anderson
 
Semantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptxSemantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptxMike Bennett
 
detection and classification of knee osteoarthritis.pptx
detection and classification of knee osteoarthritis.pptxdetection and classification of knee osteoarthritis.pptx
detection and classification of knee osteoarthritis.pptxAleenaJamil4
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfchwongval
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...GQ Research
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfBoston Institute of Analytics
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改yuu sss
 
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024Timothy Spann
 
LLMs, LMMs, their Improvement Suggestions and the Path towards AGI
LLMs, LMMs, their Improvement Suggestions and the Path towards AGILLMs, LMMs, their Improvement Suggestions and the Path towards AGI
LLMs, LMMs, their Improvement Suggestions and the Path towards AGIThomas Poetter
 
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degreeyuu sss
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...limedy534
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPTBoston Institute of Analytics
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Cantervoginip
 
Thiophen Mechanism khhjjjjjjjhhhhhhhhhhh
Thiophen Mechanism khhjjjjjjjhhhhhhhhhhhThiophen Mechanism khhjjjjjjjhhhhhhhhhhh
Thiophen Mechanism khhjjjjjjjhhhhhhhhhhhYasamin16
 
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesConf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesTimothy Spann
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectBoston Institute of Analytics
 

Recently uploaded (20)

Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data Story
 
Semantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptxSemantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptx
 
detection and classification of knee osteoarthritis.pptx
detection and classification of knee osteoarthritis.pptxdetection and classification of knee osteoarthritis.pptx
detection and classification of knee osteoarthritis.pptx
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdf
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
Biometric Authentication: The Evolution, Applications, Benefits and Challenge...
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
 
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
April 2024 - NLIT Cloudera Real-Time LLM Streaming 2024
 
LLMs, LMMs, their Improvement Suggestions and the Path towards AGI
LLMs, LMMs, their Improvement Suggestions and the Path towards AGILLMs, LMMs, their Improvement Suggestions and the Path towards AGI
LLMs, LMMs, their Improvement Suggestions and the Path towards AGI
 
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Canter
 
Thiophen Mechanism khhjjjjjjjhhhhhhhhhhh
Thiophen Mechanism khhjjjjjjjhhhhhhhhhhhThiophen Mechanism khhjjjjjjjhhhhhhhhhhh
Thiophen Mechanism khhjjjjjjjhhhhhhhhhhh
 
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesConf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis Project
 

Featured

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Stata cheat sheet: data visualization customization

  • 1. Laura Hughes (lhughes@usaid.gov) • Tim Essam (tessam@usaid.gov) follow us @flaneuseks and @StataRGIS inspired by RStudio’s awesome Cheat Sheets (rstudio.com/resources/cheatsheets) updated June 2016 CC BY 4.0 geocenter.github.io/StataTraining Disclaimer: we are not affiliated with Stata. But we like it. SYMBOLS TEXTLINES / BORDERS xlabel(#10, tposition(crossing)) number of tick marks, position (outside | crossing | inside) tick marks legend line tick marks grid lines axes <line options> xline(...) yline(...) xscale(...) yscale(...) legend(region(...)) xlabel(...) ylabel(...) <marker options> marker axis labels legend xlabel(...) ylabel(...) legend(...) title(...) subtitle(...) xtitle(...) ytitle(...) titles text(...) <marker options> marker label annotation jitter(#) randomly displace the markers jitterseed(#) marker arguments for the plot objects (in green) go in the options portion of these commands (in orange) <marker options> mcolor(none)mcolor("145 168 208") specify the fill and stroke of the marker in RGB or with a Stata color mfcolor("145 168 208") mfcolor(none) specify the fill of the marker lcolor("145 168 208") specify the stroke color of the line or border lcolor(none) mlcolor("145 168 208") glcolor("145 168 208") tlcolor("145 168 208") marker grid lines tick marks mlabcolor("145 168 208") labcolor("145 168 208") specify the color of the text color("145 168 208") color(none) axis labels marker label ehuge vhuge huge vlarge large medlarge medium medsmall tiny vtiny vsmall small msize(medium) specify the marker size: huge20 pt. vhuge 28 pt. 16 pt. vlarge 14 pt. large 12 pt. medlarge 11 pt. medium 1.3 pt. third_tiny 1 pt. quarter_tiny 1 pt minuscule half_tiny2 pt. tiny4 pt. vsmall6 pt. 10 pt. medsmall 8 pt. small mlabsize(medsmall) specify the size of the text: labsize(medsmall) size(medsmall) axis labels marker label vvvthick medthin vvthick thin medium none vthick vthin medthick vvvthin thick vvthin lwidth(medthick) specify the thickness (stroke) of a line: mlwidth(thin) glwidth(thin) tlwidth(thin) marker grid lines tick marks label location relative to marker (clock position: 0 – 12) mlabposition(5)marker label POSITION msymbol(Dh) specify the marker symbol: O o oh Oh + D d dh Dh X T t th Th p i S s sh Sh none format(%12.2f ) change the format of the axis labels axis labels nolabels no axis labels axis labels mlabel(foreign) label the points with the values of the foreign variable marker label off turn off legend legend label(# "label") change legend label text legend glpattern(dash) solid longdash longdash_dot dot dash_dot blank dash shortdash shortdash_dot lpattern(dash) grid lines line axes specify the line pattern tlength(2)tick marks nogmin nogmax offaxesnoline nogrid noticks axes grid lines tick marks no axis/labels set seed for example: scatter price mpg, xline(20, lwidth(vthick)) SYNTAXSIZE/THICKNESSSAPPEARANCECOLOR Plotting in Stata 14.1 Customizing Appearance For more info see Stata’s reference manual (stata.com) Schemes are sets of graphical parameters, so you don’t have to specify the look of the graphs every time. Apply Themes adopath ++ "~/<location>/StataThemes" set path of the folder (StataThemes) where custom .scheme files are saved net inst brewscheme, from("https://wbuchanan.github.io/brewscheme/") replace install William Buchanan’s package to generate custom schemes and color palettes (including ColorBrewer) twoway scatter mpg price, scheme(customTheme) USING A SAVED THEME help scheme entries see all options for setting scheme properties Create custom themes by saving options in a .scheme file set scheme customTheme, permanently change the theme set as default scheme twoway scatter mpg price, play(graphEditorTheme) USING THE GRAPH EDITOR Select the Graph Editor Click Record Double click on symbols and areas on plot, or regions on sidebar to customize Save theme as a .grec file Unclick Record 1 2 3 4 5 6 7 8 9 10 050100150200 y-axistitle 0 20 40 60 80 100 x-axis title y2 Fitted values subtitle title legend x-axis y-axis y-line y-axis title y-axis labels titles marker label line marker tick marks grid lines annotation plots contain many features ANATOMY OF A PLOT scatter price mpg, graphregion(fcolor("192 192 192") ifcolor("208 208 208")) specify the fill of the background in RGB or with a Stata color scatter price mpg, plotregion(fcolor("224 224 224") ifcolor("240 240 240")) specify the fill of the plot background in RGB or with a Stata color outer region inner region inner plot region graph region inner graph region plot region Save Plots graph twoway scatter y x, saving("myPlot.gph") replace save the graph when drawing graph save "myPlot.gph", replace save current graph to disk graph export "myPlot.pdf", as(.pdf) export the current graph as an image file graph combine plot1.gph plot2.gph... combine 2+ saved graphs into a single plot see options to set size and resolution