Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcmenem/ggshadow
A collection of geoms for R's 'ggplot2' library. geom_shadowpath(), geom_shadowline(), geom_shadowstep() and geom_shadowpoint() functions draw a shadow below lines to make busy plots more aesthetically pleasing. geom_glowpath(), geom_glowline(), geom_glowstep() and geom_glowpoint() add a neon glow around lines to get a steampunk style.
https://github.com/marcmenem/ggshadow
data-visualisation ggplot2 r rstats vizualisation
Last synced: 3 months ago
JSON representation
A collection of geoms for R's 'ggplot2' library. geom_shadowpath(), geom_shadowline(), geom_shadowstep() and geom_shadowpoint() functions draw a shadow below lines to make busy plots more aesthetically pleasing. geom_glowpath(), geom_glowline(), geom_glowstep() and geom_glowpoint() add a neon glow around lines to get a steampunk style.
- Host: GitHub
- URL: https://github.com/marcmenem/ggshadow
- Owner: marcmenem
- License: gpl-2.0
- Created: 2020-04-16T21:16:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-03-16T10:43:07.000Z (8 months ago)
- Last Synced: 2024-07-16T23:02:46.469Z (4 months ago)
- Topics: data-visualisation, ggplot2, r, rstats, vizualisation
- Language: R
- Homepage:
- Size: 1.79 MB
- Stars: 61
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
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 = "100%"
)
```# ggshadow
[![CRAN status](https://www.r-pkg.org/badges/version/ggshadow)](https://CRAN.R-project.org/package=ggshadow)
[![License: GPL v2](https://img.shields.io/badge/License-GPL_v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)The goal of ggshadow is to provide shadow and glow geoms for points and lines plots created with 'ggplot2'.
## :arrow_double_down: Installation
You can install the development version of ggshadow from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
pak::pkg_install("marcmenem/ggshadow")
```## :book: Vignette
```{r vignette}
## after installing the package
# vignette("ggshadow", package = "ggshadow")
```## :chart: Example
### With ggshadow
```{r example}
library(ggplot2)
library(ggshadow)ggplot(economics_long, aes(date, value01, colour = variable)) +
geom_shadowline()
```### Without ggshadow
```{r lineex}
ggplot(economics_long, aes(date, value01, colour = variable)) +
geom_line()
```### `ggshadow` supports varying the line color
```{r colorvarex}
ggplot(
economics_long,
aes(date, value01,
group = variable,
colour = value01,
shadowlinewidth = 5 * (1 - value01)
)
) +
geom_shadowline(
shadowcolour = "grey",
shadowalpha = 0.5
)
```### `ggshadow` also provides a Neon glow style
```{r example-glow}
ggplot(economics_long, aes(date, value01, color = variable)) +
geom_glowline() +
guides(color = "none") +
theme(
plot.background = element_rect(fill = "#190132"),
panel.background = element_rect(fill = "#190132")
)
```### Neon glow points
```{r example-glowpoint}
ggplot(mtcars, aes(wt, mpg)) +
geom_glowpoint(color = "yellow") +
guides(color = "none") +
theme(
plot.background = element_rect(fill = "#190132"),
panel.background = element_rect(fill = "#190132")
)
```### Adding a fill below the neon glow line
```{r example-glowlinefill}
ggplot(
economics_long[economics_long$variable %in% c("pop", "unemploy"), ],
aes(date, value01 - 0.5, color = variable, fill = variable)
) +
geom_glowline() +
guides(color = "none", shadowcolour = "none", fill = "none") +
theme(
plot.background = element_rect(fill = "#190132"),
panel.background = element_rect(fill = "#190132")
)
```