An open API service indexing awesome lists of open source software.

https://github.com/dracula/dracula

🧛🏻‍♂️ Dark theme for R
https://github.com/dracula/dracula

dark-theme dracula dracula-color-scheme dracula-theme ggplot2 ggplot2-themes r theme

Last synced: 3 months ago
JSON representation

🧛🏻‍♂️ Dark theme for R

Awesome Lists containing this project

README

        

---
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
)
```

# {`dRacula`} | Dracula Theme for R Dracula logo in an R hex sticker

[![R-CMD-check](https://github.com/dracula/dRacula/actions/workflows/R-CMD-check.yaml/badge.svg)](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()
```

Dracula-branded Shiny App

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).

| [![Jordan Bradford](https://github.com/jrdnbradford.png?size=100)](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)