-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.rmd
140 lines (111 loc) · 4.08 KB
/
README.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
output: md_document
---
<h3 align="center">
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/logos/exports/1544x1544_circle.png" width="100" alt="Logo"/><br/>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
Catppuccin for <a href="https://github.com/catppuccin/template">ggplot</a>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
</h3>
<p align="center">
<a href="https://github.com/albert-ying/catppuccin/stargazers"><img src="https://img.shields.io/github/stars/albert-ying/catppuccin?colorA=363a4f&colorB=b7bdf8&style=for-the-badge"></a>
<a href="https://github.com/albert-ying/catppuccin/issues"><img src="https://img.shields.io/github/issues/albert-ying/catppuccin?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a>
<a href="https://github.com/albert-ying/catppuccin/contributors"><img src="https://img.shields.io/github/contributors/albert-ying/catppuccin?colorA=363a4f&colorB=a6da95&style=for-the-badge"></a>
</p>
<p align="center">
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/previews/preview.webp"/>
</p>
```{r echo=FALSE, message=FALSE, warning=FALSE}
library(ggplot2)
library(catppuccin)
library(gridExtra)
## set ggplo2 theme
data("diamonds")
p1 <- ggplot(
subset(diamonds, carat >= 2.2),
aes(x = table, y = price, colour = cut)
) +
geom_point(alpha = 0.7) +
geom_smooth(method = "loess", alpha = 0.05, size = 1, span = 1) +
theme_bw() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank()
)
p2 <- ggplot(
subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
aes(x = depth, fill = cut)
) +
geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
theme_bw() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank()
)
```
## Previews
🌻 Latte
``` {r, echo = F, fig.width = 10, fig.height = 3, dpi = 300}
p1_npg <- p1 + scale_color_catppuccin(palette = "latte")
p2_npg <- p2 + scale_fill_catppuccin(palette = "latte")
grid.arrange(p1_npg, p2_npg, ncol = 2)
```
🪴 Frappé
``` {r, echo = F, fig.width = 10, fig.height = 3, dpi = 300}
p1_npg <- p1 + scale_color_catppuccin(palette = "frappe")
p2_npg <- p2 + scale_fill_catppuccin(palette = "frappe")
grid.arrange(p1_npg, p2_npg, ncol = 2)
```
🌺 Macchiato
``` {r, echo = F, fig.width = 10, fig.height = 3, dpi = 300}
p1_npg <- p1 + scale_color_catppuccin(palette = "macchiato")
p2_npg <- p2 + scale_fill_catppuccin(palette = "macchiato")
grid.arrange(p1_npg, p2_npg, ncol = 2)
```
🌿 Mocha
``` {r, echo = F, fig.width = 10, fig.height = 3, dpi = 300}
p1_npg <- p1 + scale_color_catppuccin(palette = "mocha")
p2_npg <- p2 + scale_fill_catppuccin(palette = "mocha")
grid.arrange(p1_npg, p2_npg, ncol = 2)
```
## Installation
```r
# install.packages("devtools")
devtools::install_github("albert-ying/catppuccin")
```
## Usage
```{r}
library(ggplot2)
library(catppuccin)
```
```{r}
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(colour = factor(cyl))) +
scale_colour_catppuccin(palette = "latte") +
theme_bw()
```
```{r}
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(colour = hp)) +
scale_colour_catppuccin(palette = "frappe", discrete = FALSE) +
theme_bw()
```
```{r}
ggplot(data = mpg) +
geom_point(mapping = aes(x = displ, y = hwy, color = class)) +
scale_colour_catppuccin(palette = "macchiato") +
theme_bw()
```
```{r}
ggplot(diamonds) +
geom_bar(aes(x = cut, fill = clarity)) +
scale_fill_catppuccin() +
theme_bw()
```
<p align="center">
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/footers/gray0_ctp_on_line.svg?sanitize=true" />
</p>
<p align="center">
<a href="https://github.com/catppuccin/catppuccin/blob/main/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8"/></a>
</p>