customizing stata graphs made easy
play

Customizing Stata graphs made easy Ben Jann University of Bern, - PowerPoint PPT Presentation

Customizing Stata graphs made easy Ben Jann University of Bern, ben.jann@soz.unibe.ch 2018 Swiss Stata Users Group Meeting Zurich, October 25, 2018 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 1 Outline Introduction 1


  1. Customizing Stata graphs made easy Ben Jann University of Bern, ben.jann@soz.unibe.ch 2018 Swiss Stata Users Group Meeting Zurich, October 25, 2018 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 1

  2. Outline Introduction 1 Overview of new Stata commands 2 Basic procedure 3 Composite settings 4 Summary 5 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 2

  3. Stata’s graph schemes Stata provides a number of so-called schemes that define the overall look of graphs. Some examples are as follows. Load data: . sysuse auto, clear (1978 Automobile Data) . generate pfor = price if foreign==1 & rep78>=3 (52 missing values generated) . generate pdom = price if foreign==0 & rep78>=3 (32 missing values generated) . separate price if rep78>=3, by(rep78) shortlabel storage display value variable name type format label variable label price3 int %8.0gc rep78 == 3 price4 int %8.0gc rep78 == 4 price5 int %8.0gc rep78 == 5 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 3

  4. 15000 . set scheme s2color . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) 10000 > (scatter price? length, pstyle(p3 p4 p5)) Price > , ytitle(Price) legend(order(2 "Domestic" > 4 "Foreign" 5 6 7)) 5000 0 140 160 180 200 220 240 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 15000 . set scheme s1mono . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) 10000 > (scatter price? length, pstyle(p3 p4 p5)) Price > , ytitle(Price) legend(order(2 "Domestic" > 4 "Foreign" 5 6 7)) 5000 0 140 160 180 200 220 240 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 4

  5. . set scheme economist Domestic Foreign rep78 == 3 . two (lpolyci pfor length, clstyle(p1line)) rep78 == 4 rep78 == 5 > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) 15000 > , ytitle(Price) legend(order(2 "Domestic" > 4 "Foreign" 5 6 7)) 10000 Price 5000 0 140 160 180 200 220 240 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 5

  6. User contributed schemes The number of available schemes in official Stata is somewhat limited. Hence, some users took the effort to develop custom scheme files and make them publicly available. Examples are as follows. Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 6

  7. Atz (2011) . set scheme tufte 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) 10000 > (scatter price? length, pstyle(p3 p4 p5)) Price > , ytitle(Price) legend(order(2 "Domestic" > 4 "Foreign" 5 6 7)) 5000 0 140 160 180 200 220 240 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 7

  8. Bischof (2017a) . two (lpolyci pfor length, clstyle(p1line)) 15000 > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) > , ytitle(Price) legend(order(2 "Domestic" 10000 > 4 "Foreign" 5 6 7)) scheme(538) Price 5000 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 0 140 160 180 200 220 240 . two (lpolyci pfor length, clstyle(p1line)) 15000 > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) > , ytitle(Price) legend(order(2 "Domestic" 10000 > 4 "Foreign" 5 6 7)) scheme(538bw) Price 5000 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 0 140 160 180 200 220 240 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 8

  9. Bischof (2017b) . set scheme plotplain 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) 10000 > , ytitle(Price) legend(order(2 "Domestic" Price > 4 "Foreign" 5 6 7)) 5000 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 0 140 160 180 200 220 240 . set scheme plotplainblind 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) 10000 > , ytitle(Price) legend(order(2 "Domestic" Price > 4 "Foreign" 5 6 7)) 5000 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 0 140 160 180 200 220 240 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 9

  10. Bischof (2017b) . set scheme plottig 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) 10000 > , ytitle(Price) legend(order(2 "Domestic" Price > 4 "Foreign" 5 6 7)) 5000 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 0 140 160 180 200 220 240 . set scheme plottigblind 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) 10000 > , ytitle(Price) legend(order(2 "Domestic" Price > 4 "Foreign" 5 6 7)) (note: clockdir zyx2legend_position not found in scheme, default attributes used) 5000 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 0 140 160 180 200 220 240 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 10

  11. Briatte (2013) Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 . set scheme burd 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) > , ytitle(Price) legend(order(2 "Domestic" 10000 Price > 4 "Foreign" 5 6 7)) 5000 0 140 160 180 200 220 240 . set scheme burd5 . graph hbar price, over(rep78) asyvars > stack percent over(foreign) legend(off) Domestic Foreign 0 20 40 60 80 100 percent of mean of price Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 11

  12. Juul (2003) . set scheme lean1 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) 10000 > , ytitle(Price) legend(order(2 "Domestic" Price > 4 "Foreign" 5 6 7)) 5000 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 0 140 160 180 200 220 240 . set scheme lean2 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) 10000 > , ytitle(Price) legend(order(2 "Domestic" Price > 4 "Foreign" 5 6 7)) 5000 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 0 140 160 180 200 220 240 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 12

  13. Kimbrough (2018) 15000 . set scheme uncluttered . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) 10000 > (scatter price? length, pstyle(p3 p4 p5)) Price > , ytitle(Price) legend(order(2 "Domestic" > 4 "Foreign" 5 6 7)) 5000 0 140 160 180 200 220 240 . set scheme uncluttered_publication 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) 10000 > , ytitle(Price) legend(order(2 "Domestic" > 4 "Foreign" 5 6 7)) Price 5000 0 140 160 180 200 220 240 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 13

  14. Morris (2013, 2015) 15000 . set scheme mrc . two (lpolyci pfor length, clstyle(p1line)) 10000 > (lpolyci pdom length, clstyle(p2line)) Price > (scatter price? length, pstyle(p3 p4 p5)) > , ytitle(Price) legend(order(2 "Domestic" 5000 > 4 "Foreign" 5 6 7)) 0 140 160 180 200 220 240 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 . set scheme tfl 15000 . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) 10000 > (scatter price? length, pstyle(p3 p4 p5)) Price > , ytitle(Price) legend(order(2 "Domestic" > 4 "Foreign" 5 6 7)) 5000 (note: anglestyle symbol not found in scheme, default attributes used) (note: anglestyle symbol not found in scheme, default attributes used) (note: anglestyle symbol not found in scheme, default attributes used) 0 (note: anglestyle symbol not found in scheme, default attributes used) 140 160 180 200 220 240 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 14

  15. Newson (2005) 15000 . set scheme rbn1mono 10000 . two (lpolyci pfor length, clstyle(p1line)) Price > (lpolyci pdom length, clstyle(p2line)) > (scatter price? length, pstyle(p3 p4 p5)) 5000 > , ytitle(Price) legend(order(2 "Domestic" > 4 "Foreign" 5 6 7)) 0 140 160 180 200 220 240 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 15000 . set scheme rbn3mono . two (lpolyci pfor length, clstyle(p1line)) > (lpolyci pdom length, clstyle(p2line)) 10000 Price > (scatter price? length, pstyle(p3 p4 p5)) > , ytitle(Price) legend(order(2 "Domestic" 5000 > 4 "Foreign" 5 6 7)) 0 140 160 180 200 220 240 Domestic Foreign rep78 == 3 rep78 == 4 rep78 == 5 Ben Jann (University of Bern) grstyle Zurich, 25.10.2018 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend