Data visualization¶
This page covers data visualization using different programming tools, including R, Stata, and Python.
Related pages:
Resources¶
Style guides¶
Documentation¶
- TBD
- TBD
- TBD
Community guides¶
Cheatsheets¶
General discussions¶
Compilation of resources:¶
- TBD
Templates¶
Graphs made from one dataset¶
Figure style guides¶
Remove the clutter¶
TBD
Languages and packages¶
ggplot2¶
R
ggplot(data = DATA) +
GEOM_FUNCTION() +
COORDINATE_FUNCTION() +
FACET_FUNCTION() +
SCALE_FUNCTION() +
ANNOTATION_FUNCTION() +
THEME_FUNCTION()
Summary¶
Types of graphs¶
Bar graphs¶
Line graphs¶
Graphs with intervals¶
Graphs with intervals are great for visualizing confidence intervals, among other things.
A rule of thumb: error cap \(\approx\) \(20--25\%\) of bar width.
TBD
TBD
Add a verticle / horizontal line¶
Scales¶
y- or x-axis¶
Percent
Data Aesthetics¶
Color (color / fill)¶
In the terminology of ggplot2, color refers to both the color and fill aesthetics.
Transparency¶
TBD
Linetype¶
TBD
Linewidth¶
TBD
Shape¶
TBD
Size¶
TBD
Other graph elements¶
Grid¶
Axis title¶
Legend¶
Manipulating graphs¶
Faceting¶
Put graphs together¶
Saving and storing a graph¶
For reproducibility, we can specify as many ambiguously determined parameters as possible.
Graph size¶
Full width:
- 6.5 \(\times\) 3.5 in
Middle ground:
-
6 \(\times\) 3.5 in
-
6 \(\times\) 3.8 in
Compact:
- 4.8 \(\times\) 3.2 in