Home

Awesome

<!-- README.md is generated from README.Rmd. Please edit that file -->

ggshadow

<!-- badges: start -->

CRAN
status License: GPL
v2 Lifecycle:
stable

<!-- badges: end -->

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 with:

# install.packages("devtools")
pak::pkg_install("marcmenem/ggshadow")

:book: Vignette

## after installing the package
# vignette("ggshadow", package = "ggshadow")

:chart: Example

With ggshadow

library(ggplot2)
library(ggshadow)

ggplot(economics_long, aes(date, value01, colour = variable)) +
  geom_shadowline()
<img src="man/figures/README-example-1.png" width="100%" />

Without ggshadow

ggplot(economics_long, aes(date, value01, colour = variable)) +
  geom_line()
<img src="man/figures/README-lineex-1.png" width="100%" />

ggshadow supports varying the line color

ggplot(
  economics_long,
  aes(date, value01,
    group = variable,
    colour = value01,
    shadowlinewidth = 5 * (1 - value01)
  )
) +
  geom_shadowline(
    shadowcolour = "grey",
    shadowalpha = 0.5
  )
<img src="man/figures/README-colorvarex-1.png" width="100%" />

ggshadow also provides a Neon glow style

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")
  )
<img src="man/figures/README-example-glow-1.png" width="100%" />

Neon glow points

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")
  )
<img src="man/figures/README-example-glowpoint-1.png" width="100%" />

Adding a fill below the neon glow line

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")
  )
<img src="man/figures/README-example-glowlinefill-1.png" width="100%" />