-
Notifications
You must be signed in to change notification settings - Fork 39
/
ggalt.Rmd
34 lines (27 loc) · 1 KB
/
ggalt.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
---
title: "ggplot2 extensions: ggalt"
---
### ggalt
<https://github.com/hrbrmstr/ggalt>
A compendium of 'geoms', 'coords' and 'stats' for 'ggplot2', including splines, 1d and 2d densities, univariate average shifted histograms and a new map coordinate system based on the 'PROJ.4'-library..
```{r, message=FALSE,warning=FALSE}
# Example from https://github.com/hrbrmstr/ggalt
library(ggplot2)
library(gridExtra)
library(ggalt)
set.seed(1492)
dat <- data.frame(x=c(1:10, 1:10, 1:10),
y=c(sample(15:30, 10), 2*sample(15:30, 10), 3*sample(15:30, 10)),
group=factor(c(rep(1, 10), rep(2, 10), rep(3, 10)))
)
ggplot(dat, aes(x, y, group=group, color=factor(group))) +
geom_point(color="black") +
geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
geom_xspline(spline_shape=-0.4, size=0.5)
## Alternate 2D density plots
ggplot(faithful, aes(x = eruptions, y = waiting)) +
geom_point() +
xlim(0.5, 6) +
ylim(40, 110) +
geom_bkde2d(bandwidth=c(0.5, 4))
```