Crafting Graph Schemes in Stata by Tim Morris at UCL

Scheme scheme, plot plot: crafting
graph schemes in Stata
T
i
m
 
M
o
r
r
i
s
 
M
R
C
 
C
l
i
n
i
c
a
l
 
T
r
i
a
l
s
 
U
n
i
t
 
a
t
 
U
C
L
7 Sep 2017
Two poets
By all means break the rules, and break them
beautifully, deliberately and well.
– Robert Bringhurst
The Elements of Typographic Style
Removing the ‘
typo
’s
T
y
p
o
g
r
a
p
h
y
 
s
h
o
u
l
d
 
h
o
n
o
u
r
 
t
h
e
 
t
e
x
t
 
d
a
t
a
 
f
o
r
 
i
t
s
 
o
w
n
s
a
k
e
 
 
a
l
w
a
y
s
 
a
s
s
u
m
i
n
g
 
t
h
a
t
 
t
h
e
 
t
e
x
t
 
d
a
t
a
 
i
s
 
w
o
r
t
h
a
 
t
y
p
o
g
r
a
p
h
e
r
s
 
t
r
o
u
b
l
e
 
 
a
n
d
 
i
t
 
s
h
o
u
l
d
 
h
o
n
o
u
r
 
a
n
d
c
o
n
t
r
i
b
u
t
e
 
t
o
 
i
t
s
 
o
w
n
 
t
r
a
d
i
t
i
o
n
:
 
t
h
a
t
 
o
f
 
t
y
p
o
g
r
a
p
h
y
i
t
s
e
l
f
.
Robert Bringhurst
The Elements of 
Typo
graphic Style
. tw (scatter price weight if foreign)
> (scatter price weight if !foreign)
 
Wow, ggp%*t default also looks this bad!
Legibility, in practice, amounts simply to what one
is accustomed to.
– Eric Gill
An essay on typography
, 1936
… , scheme(s1mono)
… , … ylabel(,angle(0))
Why? Let’s recode $ to ¢
Why? Let’s recode $ to ¢
. tw (scatter …, msymbol(Oh))
> (scatter …, msymbol(Oh)), …
… ytitle(,orientation(0))
> plotregion(style(none))
> ylabel(,angle(0) noticks grid gmin)
> xlabel(,noticks)
> yscale(noline) xscale(noline)
E
v
e
r
y
.
 
S
i
n
g
l
e
.
 
T
i
m
e
.
 
(
a
l
m
o
s
t
)
. tw (scatter price weight if  foreign,
      
msymbol(Oh) mcolor("33 103 126")
)
     (scatter price weight if !foreign,
      
msymbol(Oh) mcolor("106 59 119")
)
  ,
  
ytitle(,orientation(0))
  ylabel(,angle(0) noticks grid gmin)
  xlabel(,noticks)
  yscale(noline)
  xscale(noline)
  plotregion(style(none))
Discovering scheme files
Several years ago, Rachel Jinks and I were
looking through our adopaths, as you do, and
stumbled across the base\style directory
Opened something like color-blue.style and saw
that it contains
. set rgb "0 0 255"
I set-to writing my own to match MRC’s branding
Discovering scheme files
Not yet content, we stumbled across
scheme-s2color.scheme
It was easy enough to read, so I started
tinkering…
W
i
t
h
i
n
 
a
 
f
e
w
 
h
o
u
r
s
,
 
h
a
d
 
d
o
n
e
 
a
l
l
 
o
f
 
t
h
e
e
v
e
r
y
-
s
i
n
g
l
e
-
t
i
m
e
 
c
h
a
n
g
e
s
 
s
o
 
I
 
h
a
d
 
t
o
 
d
o
t
h
e
m
 
N
o
.
 
M
o
r
e
.
 
T
i
m
e
s
.
Help: scheme entries
At the time, I wasn’t aware of the ‘scheme
entries’ help
It’s helpful
I
m
p
o
r
t
a
n
t
l
y
:
 
y
o
u
 
d
o
n
t
 
h
a
v
e
 
t
o
 
w
r
i
t
e
 
a
 
f
u
l
l
s
c
h
e
m
e
 
f
i
l
e
.
 
O
f
 
S
t
a
t
a
s
 
b
a
s
e
 
s
c
h
e
m
e
s
,
 
o
n
l
y
s
2
c
o
l
o
r
 
i
s
 
f
u
l
l
To write your own scheme, start file with:
 
#include s2color
Inherits everything that you don’t change
E
x
a
m
p
l
e
:
 
s
c
h
e
m
e
-
m
y
.
s
c
h
e
m
e
(
g
o
e
s
 
i
n
 
a
d
o
p
a
t
h
 
a
t
 
p
e
r
s
o
n
a
l
\
s
)
#include s2color
color background white
anglestyle vertical_tick horizontal
symbol p circle_hollow
color plotregion_line    none
yesno draw_major_vgrid       yes
yesno extend_axes_full_low   no
yesno extend_axes_full_high  no
Writing your own scheme
Work cautiously when writing a scheme
Nice effects on one plot type may have
unintended consequences on others
Build scheme with a primary plot but have a
battery of others to check against
Can spend a long time on a scheme then
suddenly realise you’ve broken something and
can’t get back
Why don’t many people know?
I
t
s
 
m
o
s
t
l
y
 
b
e
c
a
u
s
e
 
V
i
n
c
e
 
d
i
d
n
t
 
u
s
e
 
a
 
L
u
d
a
c
r
i
s
l
y
r
i
c
 
a
s
 
h
i
s
 
p
r
e
s
e
n
t
a
t
i
o
n
 
t
i
t
l
e
A lot of scheme-changing is about colour. I wrote a
brief how-to paper. Then realised:
doesn’t do colour
Why don’t many people know?
Finally
In the spirit of keeping Wishes and Grumbles to
time:
1.
Grumble: 
The Stata Journal
 doesn’t allow
colour
2.
Wish: That 
The Stata Journal
 would allow
colour
    (and put my paper in the first issue)
Slide Note
Embed
Share

Explore the art of crafting graph schemes in Stata presented by Tim Morris from the MRC Clinical Trials Unit at UCL. The content showcases the beauty of breaking rules in typography with insightful quotes and visual examples.

  • Graph Schemes
  • Stata
  • Typography
  • Data Visualization

Uploaded on Sep 29, 2024 | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Scheme scheme, plot plot: crafting graph schemes in Stata Tim Morris MRC Clinical Trials Unit at UCL 7 Sep 2017

  2. Two poets

  3. By all means break the rules, and break them beautifully, deliberately and well. Robert Bringhurst The Elements of Typographic Style

  4. Removing the typos Typography should honour the text data for its own sake always assuming that the text data is worth a typographer s trouble and it should honour and contribute to its own tradition: that of typography itself. Robert Bringhurst The Elements of Typographic Style

  5. . tw (scatter price weight if foreign) > (scatter price weight if !foreign) 15,000 10,000 Price 5,000 0 2,000 3,000 4,000 5,000 Weight (lbs.) Price Price Wow, ggp%*t default also looks this bad!

  6. Legibility, in practice, amounts simply to what one is accustomed to. Eric Gill An essay on typography, 1936

  7. , scheme(s1mono) 15,000 10,000 Price 5,000 0 2,000 3,000 4,000 5,000 Weight (lbs.) Price Price

  8. , ylabel(,angle(0)) 15,000 10,000 Price 5,000 0 2,000 3,000 4,000 5,000 Weight (lbs.) Price Price

  9. Why? Lets recode $ to 1,500,000 1,250,000 1,000,000 Price ( ) 250,000 500,000 750,000 0 2,000 3,000 4,000 5,000 Weight (lbs.) Price ( ) Price ( )

  10. Why? Lets recode $ to 1,500,000 1,250,000 1,000,000 Price ( ) 750,000 500,000 250,000 0 2,000 3,000 4,000 5,000 Weight (lbs.) Price ( ) Price ( )

  11. . tw (scatter , msymbol(Oh)) > (scatter , msymbol(Oh)), 15,000 10,000 Price 5,000 0 2,000 3,000 4,000 5,000 Weight (lbs.) Price Price

  12. ytitle(,orientation(0)) > plotregion(style(none)) > ylabel(,angle(0) noticks grid gmin) > xlabel(,noticks) > yscale(noline) xscale(noline) 15,000 10,000 Price 5,000 0 2,000 3,000 4,000 5,000 Weight (lbs.) Price Price

  13. Every. Single. Time. (almost) . tw (scatter price weight if foreign, msymbol(Oh) mcolor("33 103 126")) (scatter price weight if !foreign, msymbol(Oh) mcolor("106 59 119")) , ytitle(,orientation(0)) ylabel(,angle(0) noticks grid gmin) xlabel(,noticks) yscale(noline) xscale(noline) plotregion(style(none))

  14. Discovering scheme files Several years ago, Rachel Jinks and I were looking through our adopaths, as you do, and stumbled across the base\style directory Opened something like color-blue.style and saw that it contains . set rgb "0 0 255" I set-to writing my own to match MRC s branding

  15. Discovering scheme files Not yet content, we stumbled across scheme-s2color.scheme It was easy enough to read, so I started tinkering Within a few hours, had done all of the every-single-time changes so I had to do them No. More. Times.

  16. Help: scheme entries At the time, I wasn t aware of the scheme entries help It s helpful Importantly: you don t have to write a full scheme file. Of Stata s base schemes, only s2color is full To write your own scheme, start file with: #include s2color Inherits everything that you don t change

  17. Example: scheme-my.scheme (goes in adopath at personal\s) 15,000 #include s2color color background white anglestyle vertical_tick horizontal symbol p circle_hollow color plotregion_line none yesno draw_major_vgrid yes yesno extend_axes_full_low no yesno extend_axes_full_high no 10,000 Price 5,000 0 2,000 3,000 4,000 5,000 Weight (lbs.) Price Price

  18. Writing your own scheme Work cautiously when writing a scheme Nice effects on one plot type may have unintended consequences on others Build scheme with a primary plot but have a battery of others to check against Can spend a long time on a scheme then suddenly realise you ve broken something and can t get back

  19. Why dont many people know? It s mostlybecause Vince didn t use a Ludacris lyric as his presentation title

  20. Why dont many people know? A lot of scheme-changing is about colour. I wrote a brief how-to paper. Then realised: doesn t do colour

  21. Finally In the spirit of keeping Wishes and Grumbles to time: 1. Grumble: The Stata Journaldoesn t allow colour 2. Wish: That The Stata Journal would allow colour (and put my paper in the first issue)

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#