Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma...

13
Easy multi-panel plotting with grcomb Alex Gamma Swiss Stata User Group meeting Bern, Switzerland 17.11.2016

Transcript of Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma...

Page 1: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

Easy multi-panel plotting with grcomb !

Alex Gamma Swiss Stata User Group meeting Bern, Switzerland 17.11.2016

Page 2: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

◦  The problem ◦  Enter grcomb ◦  grcomb in action ◦  grcomb syntax ◦  Limits & improvements

Content

Page 3: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

The problem

◦  Quegging (Quick Exploratory Graphing) ◦  Stata’s graph combine too complicated

o  need to produce single graphs first o  combine using graph combine o  does not support wildcards in graph names

Page 4: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

. hist SCL_01, percent name(scl01)

. hist SCL_02, percent name(scl02)

. graph combine scl0*

. scl0* is not a memory graph

r(198);

The problem

Page 5: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

. ssc install grcomb

◦  requires ≥ Stata 10

Enter grcomb

Page 6: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

. grcomb hist SCL_0*, percent v(1)

grcomb in action

0

5

10

15

Percent

0 10 20 30 40

SCL_01

0

5

10

15

20

Percent

0 10 20 30 40

SCL_02

Page 7: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

. grcomb sc SCL_01 age SCL_02 age, v(2) o(abab)

grcomb in action

0

10

20

30

40

SCL_01

0 20 40 60 80

alter

0

10

20

30

40

SCL_02

0 20 40 60 80

alter

Page 8: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

. grcomb sc SCL_01 SCL_02 age age, v(2) o(aabb)

grcomb in action

0

10

20

30

40

SCL_01

0 20 40 60 80

alter

0

10

20

30

40

SCL_02

0 20 40 60 80

alter

Page 9: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

. grcomb sc SCL_0* age*2, v(2) o(aabb)

grcomb in action

0

10

20

30

40

SCL_01

0 20 40 60 80

alter

0

10

20

30

40

SCL_02

0 20 40 60 80

alter

Page 10: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

. grcomb lgraph SCL_0* agecat*2 uni*2, v(3) o(aabb) err(iqr) eop(lc(*.5)) nom sep(.01) ylab(0(5)30) xti(Age group)

grcomb in action

0

5

10

15

20

25

30

Mea

n SC

L 01

20 30 40 50Age group

No university University

0

5

10

15

20

25

30

Mea

n SC

L 02

20 30 40 50Age group

No university University

Page 11: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

. grcomb graph command var1[*#] var2[*#] var3[*#] var4[*#] [...] [if] [in] , varblock(#) [order(abab|aabb) name(name[, replace]) draw feedback graph options]

grcomb syntax

Feedback on progress

Draw single graphs

grcomb automatically names your graph uniquely

Page 12: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

Limits & improvements

◦  Combined length of variable names cannot exceed 244

◦  o(abab)is default; should be o(aabb) ◦  No options of graph combine ◦  No other luxury ◦  The first two will be addressed in a

future update on SSC ◦  The second two are features

Page 13: Easy multi-panel plotting with grcomb - Stata · Easy multi-panel plotting with grcomb! Alex Gamma ... Quegging (Quick Exploratory Graphing) Stata’s graph combine too complicated

Thanks!!

[email protected]