/
glyph.Rmd
47 lines (37 loc) · 1.46 KB
/
glyph.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: "glyphs(): Glyph plot"
output: rmarkdown::html_vignette
author: "Hadley Wickham, Charlotte Wickham, Di Cook, Heike Hofmann"
date: Nov 6, 2015
vignette: >
%\VignetteIndexEntry{glyphs(): Glyph plot}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(GGally)
```
# `GGally::glyphs()`
This function rearranges data to be able to construct a glyph plot
```{r glyphs-basic-usage, fig.height=7, fig.width=7}
library(ggplot2)
data(nasa)
temp.gly <- glyphs(nasa, "long", "day", "lat", "surftemp", height = 2.5)
ggplot(temp.gly, ggplot2::aes(gx, gy, group = gid)) +
add_ref_lines(temp.gly, color = "grey90") +
add_ref_boxes(temp.gly, color = "grey90") +
geom_path() +
theme_bw() +
labs(x = "", y = "")
```
This shows a glyphplot of monthly surface temperature for 6 years over Central America. You can see differences from one location to another, that in large areas temperature doesn't change much. There are large seasonal trends in the top left over land.
Rescaling in different ways puts emphasis on different components, see the examples in the referenced paper. And with ggplot2 you can make a map of the geographic area underlying the glyphs.
## References
Wickham, H., Hofmann, H., Wickham, C. and Cook, D. (2012)
Glyph-maps for Visually Exploring Temporal Patterns in Climate Data and Models, **Environmetrics**, *23*(5):151-182.