Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sharlagelfand/ggcute
Cute things for ggplot2.
https://github.com/sharlagelfand/ggcute
Last synced: 3 days ago
JSON representation
Cute things for ggplot2.
- Host: GitHub
- URL: https://github.com/sharlagelfand/ggcute
- Owner: sharlagelfand
- License: other
- Created: 2020-03-30T16:25:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-14T14:43:20.000Z (over 4 years ago)
- Last Synced: 2024-06-11T16:39:32.971Z (5 months ago)
- Language: R
- Size: 2.22 MB
- Stars: 29
- Watchers: 6
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
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 = "75%",
dpi = 300
)
```# ggcute
A collection of cute things to use with ggplot2.
## Installation
You can install ggcute from GitHub with:
``` r
# install.packages("remotes")
remotes::install_github("sharlagelfand/ggcute")
```## fairyfloss
`theme_fairyfloss()` is a theme based off of [sailorhg](https://twitter.com/sailorhg)'s [fairyfloss](https://sailorhg.github.io/fairyfloss/) text editor theme.
You can use it like any other ggplot2 theme:
```{r}
library(ggplot2)
library(ggcute)ggplot(nintendo_sales, aes(x = sales_million, y = console)) +
geom_col() +
facet_wrap(~sales_type) +
theme_fairyfloss()
```It's probably (definitely) not a complete theme but at least it's cute `r emo::ji("cloud")`
There is a colour palette built in:
```{r}
library(scales)show_col(ggcute:::fairyfloss_colours)
```You can use it in plots via `scale_fill_fairyfloss()`:
```{r}
ggplot(nintendo_sales, aes(x = sales_million, y = console, fill = sales_type)) +
geom_col(position = position_dodge2(width = 0.1), alpha = 0.75) +
labs(
x = "Sales (million)", y = "Console", title = "Nintendo sales by console",
subtitle = "As of December 31, 2019"
) +
scale_fill_fairyfloss() +
theme_fairyfloss()
```or `scale_colour_fairyfloss()` ("color" instead of colour works too):
```{r}
ggplot(nintendo_sales, aes(x = sales_type, y = sales_million, colour = console)) +
geom_jitter(size = 5, alpha = 0.5) +
scale_colour_fairyfloss() +
theme_fairyfloss(base_size = 12) +
theme(
legend.position = "bottom",
legend.title = element_blank()
)
```Of course, you can use the palette without the theme and it's still extremely cute:
```{r}
ggplot(head(diamonds, 1000), aes(x = cut, y = carat, colour = carat)) +
geom_jitter() +
scale_colour_fairyfloss(discrete = FALSE) +
theme_minimal()
```## sugarpilll
`theme_sugarpill()` is a theme based off the [Sugarpill](https://www.instagram.com/sugarpill/) [Fun Size eyeshadow palette](https://sugarpill.com/products/fun-size-palette). Similar to fairyfloss, there are also `scale_*_sugarpill()` functions.
```{r, message = FALSE}
library(dplyr)
library(forcats)nintendo_sales %>%
mutate(console = fct_lump_n(console, n = 8, w = sales_million, other_level = "Other Consoles")) %>%
group_by(console, sales_type) %>%
summarise(sales_million = sum(sales_million)) %>%
ungroup() %>%
ggplot(aes(x = sales_type, y = sales_million, fill = console)) +
geom_col(position = position_dodge2()) +
facet_wrap(vars(console)) +
labs(
x = "", y = "",
title = "Nintendo units sold (millions) by console",
subtitle = "Data as of December 31, 2019"
) +
scale_fill_sugarpill() +
theme_sugarpill() +
theme(legend.position = "none")
```## Data
`ggcute` comes with one data set built in, Nintendo sales as of December 31, 2019:
```{r}
nintendo_sales
```