Learn R Programming

ggshadow: Shadow Geoms for ggplot2

:arrow_double_down: Installation

Get the development version from github:

## install.packages("devtools")
devtools::install_github("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()

Without ggshadow

library(ggplot2)

ggplot(economics_long, aes(date, value01, colour = variable)) + geom_line()

ggshadow supports varying the line color

library(ggshadow)
library(ggplot2)

ggplot(economics_long, 
        aes(date, value01, 
            group = variable, 
            colour=value01, 
            shadowcolor='grey', 
            shadowalpha=0.5, 
            shadowsize=5*(1-value01))) + 
    geom_shadowline()

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

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

Adding a fill below the neon glow line

library(dplyr)

ggplot(filter( 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")) 

Copy Link

Version

Install

install.packages('ggshadow')

Monthly Downloads

312

Version

0.0.5

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Marc Menem

Last Published

November 20th, 2022

Functions in ggshadow (0.0.5)

geom_shadowpoint

Points
ggshadow-params

Default params for geoms
geom_shadowpath

Connect Observations
geom_glowpoint

Points
scale_continuous

Continuous and binned colour scales
scale_colour_steps

Binned gradient colour scales
scale_colour_hue

Evenly spaced colours for discrete data
geom_glowpath

Connect Observations
scale_brewer

Sequential, diverging and qualitative colour scales from colorbrewer.org
GeomGlowPath

ggproto classes for ggshadow
scale_gradient

Gradient colour scales
scale_viridis

Viridis colour scales from viridisLite
scale_grey

Sequential grey colour scales
scale_identity

Use values without scaling
scale_manual

Create your own discrete scale