Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 44 additions & 28 deletions README.qmd → README.Rmd
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
---
format: gfm
output: github_document
---

<!-- README.md is rendered from README.qmd. Edit README.qmd and render to update README.md -->

```{R options, echo=FALSE}
```{R options, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
message = FALSE,
warning = FALSE
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>

[![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)
Expand All @@ -21,41 +23,26 @@ knitr::opts_chunk$set(

## Install

```{R load-package, echo=FALSE}
devtools::load_all()
```

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}
```{R remotes-install, echo=TRUE, eval=FALSE, output=FALSE}
remotes::install_github("dracula/dRacula")
```

## Examples

```{R rnorm-hex-example, output=TRUE, eval=TRUE}
#| fig-width: 3.5
#| fig-height: 3
#| dpi: 150
library(dplyr)
library(ggplot2)
Add a Dracula-themed `_brand.yaml` to your project:
```{R brand, output=TRUE, message=FALSE}
library(dRacula)

set.seed(1)
ggplot(data.frame(x = rnorm(10000), y = rnorm(10000)), aes(x = x, y = y)) +
geom_hex() + coord_fixed() +
ggtitle("RNORM Hex") +
scale_fill_dracula(discrete = FALSE) + theme_dracula()
dracula_brand()
```

<p align="center"><img src="./man/figures/brand.png" alt="Dracula-branded Shiny App" width="500" height="600"></p>

```{R mpg-lm-example, output=TRUE, eval=TRUE}
#| fig-width: 3.5
#| fig-height: 3
#| dpi: 150
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)
Expand All @@ -72,6 +59,35 @@ ggplot(mtcars %>% mutate(resid = abs(resid(lm)), fitted = fitted(lm))) +
```


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).
Expand Down
55 changes: 43 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,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>
Expand All @@ -25,19 +24,19 @@ remotes::install_github("dracula/dRacula")

## Examples

Add a Dracula-themed `_brand.yaml` to your project:

``` r
library(dplyr)
library(ggplot2)
library(dRacula)

set.seed(1)
ggplot(data.frame(x = rnorm(10000), y = rnorm(10000)), aes(x = x, y = y)) +
geom_hex() + coord_fixed() +
ggtitle("RNORM Hex") +
scale_fill_dracula(discrete = FALSE) + theme_dracula()
dracula_brand()
```

![](README_files/figure-commonmark/rnorm-hex-example-1.png)
<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
library(dplyr)
Expand All @@ -55,7 +54,39 @@ ggplot(mtcars %>% mutate(resid = abs(resid(lm)), fitted = fitted(lm))) +
labs(x = "Weight", y = "MPG", color = "Residuals")
```

![](README_files/figure-commonmark/mpg-lm-example-1.png)
<img src="man/figures/README/mpg-lm-example-1.png" width="480" style="display: block; margin: auto;" />

Apply the Dracula palette and theme to proportional stacked area chart:

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

<img src="man/figures/README/proportion-1.png" width="480" style="display: block; margin: auto;" />

## Team

Expand All @@ -78,7 +109,7 @@ contributors](https://github.com/dracula/dRacula/graphs/contributors).

## Contributing

See [`CONTRIBUTING.md`](./.github/CONTRIBUTING.md).
See [`CONTRIBUTING.md`](/.github/CONTRIBUTING.md).

## Acknowledgments

Expand Down
Binary file removed README_files/figure-commonmark/mpg-lm-example-1.png
Binary file not shown.
Binary file not shown.
Binary file added man/.DS_Store
Binary file not shown.
Binary file added man/figures/README/mpg-lm-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README/proportion-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README/rnorm-hex-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/brand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading