https://github.com/fhdsl/anvilplot
Color Palette for AnVIL
https://github.com/fhdsl/anvilplot
anvil edtech-software
Last synced: 10 months ago
JSON representation
Color Palette for AnVIL
- Host: GitHub
- URL: https://github.com/fhdsl/anvilplot
- Owner: fhdsl
- License: cc-by-4.0
- Created: 2024-04-30T16:47:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-12T21:28:55.000Z (over 1 year ago)
- Last Synced: 2025-06-06T11:05:49.022Z (12 months ago)
- Topics: anvil, edtech-software
- Language: R
- Homepage:
- Size: 441 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# AnVILplot
Color Palettes for AnVIL and the ability to add an AnVIL logo to the bottom right of plots.
Colors are chosen or adapted from [AnVIL style guide](https://anvilproject.org/guides/style/color-palette).
## Installation Instructions
This package can be installed from GitHub using the `devtools` `install_github` function.
```{r}
devtools::install_github("fhdsl/AnVILplot")
```
## To use
Use this package in conjunction with `ggplot2`. You'll need to load both
```{r}
library(AnVILplot)
library(ggplot2)
```
### Adding a logo with `anvil_logo()`
Logos are added to the bottom right of a ggplot.
You can choose between two logos. One is the full AnVIL logo (default, or use argument `full_logo = TRUE`), and the other is just the image of an anvil (use argument `full_logo = FALSE`).
### Palettes Available
#### `anvil_palette_discrete`
This is 2 discrete palettes (`light` and `dark`) with each of those discrete palettes having 4 colors within that group.
```{r}
plot(anvil_palette_discrete)
```
### `anvil_palette_sequential`
This is 3 sequential palettes (`blue`, `yellow`, and `lightgreen`) with each of those sequential palettes having 7 sequential colors within that color group.
```{r}
plot(anvil_palette_sequential)
```
### `anvil_palette_sequential_blues`
This palette has 5 sequential blues.
```{r}
plot(anvil_palette_sequential_blues)
```
### `anvil_palette_diverging`
This palette has 19 colors ranging from dark blue to lighter blue, white, lighter yellows, and dark gray yellows.
```{r}
plot(anvil_palette_diverging)
```
### `anvil_palette_full`
This is the 9 colors defined in the AnVIL style guide.
```{r}
plot(anvil_palette_full)
```
### `anvil_palette_contrast2`
This is 2 contrasting colors. A blue and a drab yellow.
```{r}
plot(anvil_palette_contrast2)
```
### `anvil_palette_complement2`
This is 2 complementing colors.A darker blue and a pale turquoise.
```{r}
plot(anvil_palette_complement2)
```
### `anvil_palette_single`
This one isn't a palette at all, but just a single dark blue picked from the colors.
```{r}
plot(anvil_palette_single)
```
## Example Usage
```{r}
ggplot(diamonds[sample(nrow(diamonds), 1000), ], aes(carat, price)) +
geom_point(aes(colour = cut)) +
scale_colour_palette_d(anvil_palette_sequential$yellow) #+
#anvil_logo()
```