generated from dracula/template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
114 lines (87 loc) Β· 3.6 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
---
output: github_document
---
```{R options, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README/",
fig.retina = 2,
fig.width = 5,
fig.height = 4
)
```
<!-- README.md is rendered from README.qmd. Edit README.qmd and render to update README.md -->
# {`dRacula`} | Dracula Theme for R <a href="https://draculatheme.com/"><img src="man/figures/logo.svg" align="right" height="139" alt="Dracula logo in an R hex sticker"/></a>
[](https://github.com/dracula/dRacula/actions/workflows/R-CMD-check.yaml)
> All things Dracula themed for R
## Install
All instructions can be found at [draculatheme.com/R](https://draculatheme.com/R).
```{R devtools-install, echo=TRUE, eval=FALSE, output=FALSE}
devtools::install_github("dracula/dRacula")
```
or
```{R remotes-install, echo=TRUE, eval=FALSE, output=FALSE}
remotes::install_github("dracula/dRacula")
```
## Examples
Add a Dracula-themed `_brand.yaml` to your project:
```{R brand, output=TRUE, message=FALSE}
library(dRacula)
dracula_brand()
```
<p align="center"><img src="./man/figures/brand.png" alt="Dracula-branded Shiny App" width="500" height="600"></p>
Apply the Dracula theme and color scale to a linear regression plot:
```{R mpg-lm-example, output=TRUE, eval=TRUE, message=FALSE, warning=FALSE, fig.align='center'}
library(dplyr)
library(ggplot2)
library(dRacula)
lm <- lm(mpg ~ wt, data = mtcars)
ggplot(mtcars %>% mutate(resid = abs(resid(lm)), fitted = fitted(lm))) +
geom_line(aes(wt, fitted)) +
geom_point(aes(wt, mpg, color = resid)) +
scale_color_dracula(discrete = FALSE) +
theme_dracula() +
ggtitle("mtcars: MPG by Weight") +
labs(x = "Weight", y = "MPG", color = "Residuals")
```
Apply the Dracula palette and theme to proportional stacked area chart:
```{R proportion, fig.align='center'}
library(dplyr)
library(ggplot2)
library(dRacula)
set.seed(1)
time <- rep(seq(1, 7), each = 5)
value <- runif(35, 10, 100)
group <- rep(LETTERS[1:5], times = 7)
data <- data.frame(time, value, group) %>%
group_by(time, group) %>%
summarise(n = sum(value), .groups = "drop") %>%
mutate(percentage = n / sum(n))
ggplot(data, aes(x = time, y = percentage, fill = group)) +
geom_area(alpha = 0.7, color = "black", linewidth = 0.4) +
scale_fill_dracula(discrete = TRUE) +
labs(
title = "Proportional Stacked Area Chart",
x = "Time",
y = "Proportion",
fill = "Group"
) +
theme_dracula() +
theme(legend.position = "bottom")
```
## Team
This theme is maintained by the following person(s) and a bunch of [awesome contributors](https://github.com/dracula/dRacula/graphs/contributors).
| [](https://github.com/jrdnbradford) |
| --------------------------------------------------------------------------------------------------- |
| [Jordan Bradford](https://github.com/jrdnbradford) |
## Community
- [X](https://x.com/draculatheme) - Best for getting updates about themes and new stuff.
- [GitHub](https://github.com/dracula/dracula-theme/discussions) - Best for asking questions and discussing issues.
- [Discord](https://draculatheme.com/discord-invite) - Best for hanging out with the community.
## Contributing
See [`CONTRIBUTING.md`](/.github/CONTRIBUTING.md).
## Acknowledgments
I'm indebted to the {[viridis](https://sjmgarnier.github.io/viridis)} and {[wesanderson](https://github.com/karthik/wesanderson)} `R` packages for inspiration and several plot examples.
## License
[MIT License](./LICENSE)