| Type: | Package |
| Title: | Tinting and Shading Aesthetics for 'ggplot2' |
| Version: | 0.1.2 |
| Description: | Adds a 'tintshade' aesthetic to 'ggplot2' that varies the lightness of a mapped 'colour' or 'fill' within each hue group, keeping the plotted layer and its legend in sync. Supports both nested designs (each item belongs to one hue) and crossed designs (each lightness level appears across hues). |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Depends: | R (≥ 4.1), ggplot2 (≥ 4.0.0) |
| Imports: | cli, colorspace, grDevices, scales, stats |
| Suggests: | gtable, knitr, rmarkdown, patchwork, testthat (≥ 3.0.0), vdiffr |
| Config/testthat/edition: | 3 |
| URL: | https://github.com/wkumler/ggtintshade |
| BugReports: | https://github.com/wkumler/ggtintshade/issues |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2026-07-15 22:52:11 UTC; Will |
| Author: | William Kumler [aut, cre] |
| Maintainer: | William Kumler <wkumler@uw.edu> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-23 13:20:02 UTC |
ggtintshade: Tinting and Shading Aesthetics for 'ggplot2'
Description
Adds a 'tintshade' aesthetic to 'ggplot2' that varies the lightness of a mapped 'colour' or 'fill' within each hue group, keeping the plotted layer and its legend in sync. Supports both nested designs (each item belongs to one hue) and crossed designs (each lightness level appears across hues).
Details
The ggtintshade package is designed to provide an additional aesthetic to
typical ggplot2 plots that allows colors to be lightened/darkened by
mapping the saturation/value coordinates as well as the hue. This allows for
grouped, nested, and crossed designs where not all colors should be equally
distinct.
Most ggplot2 geoms have a tintshade equivalent, distinguished by adding
the _ggtintshade suffix (e.g. geom_point -> geom_point_tintshade).
Additional geoms are easily added by editing the geoms.R script or by
submitting a Github issue (link below) with the new geom.
Author(s)
Maintainer: William Kumler wkumler@uw.edu
See Also
Useful links:
Geoms with a tintshade aesthetic
Description
Drop-in tintshade variants of common ggplot2 geoms. Map colour or fill
to a hue and tintshade to a within-hue lightness; whichever of
colour/fill carries the hue is tinted automatically (or both, if both are
mapped). The plotted layer and its legend stay in sync.
Usage
geom_point_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_jitter_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "jitter",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_line_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_path_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_step_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_area_tintshade(
mapping = NULL,
data = NULL,
stat = "align",
position = "stack",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_ribbon_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_bar_tintshade(
mapping = NULL,
data = NULL,
stat = "count",
position = "stack",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_col_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "stack",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_histogram_tintshade(
mapping = NULL,
data = NULL,
stat = "bin",
position = "stack",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_boxplot_tintshade(
mapping = NULL,
data = NULL,
stat = "boxplot",
position = "dodge2",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_violin_tintshade(
mapping = NULL,
data = NULL,
stat = "ydensity",
position = "dodge",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_tile_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_raster_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_rect_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_polygon_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_segment_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_text_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_label_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_crossbar_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_errorbar_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_linerange_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_pointrange_tintshade(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
Arguments
mapping, data, stat, position, na.rm, show.legend, inherit.aes, ... |
Standard
|
Value
A ggplot2 layer.
See Also
scale_tintshade_discrete(), guide_tintshade()
Examples
library(ggplot2)
df <- data.frame(
g = rep(c("a", "b", "c"), each = 3),
item = rep(c("lo", "mid", "hi"), 3),
x = rep(1:3, each = 3), y = runif(9)
)
ggplot(df, aes(x, y, colour = g, tintshade = item)) +
geom_point_tintshade(size = 4)
ggplot(diamonds) +
geom_bar_tintshade(aes(x=cut, fill = cut, tintshade = clarity), color="black")
mpgsub <- head(mpg, 60)
mpgsub$model <- factor(mpgsub$model, levels=unique(mpgsub$model))
ggplot(mpgsub, aes(displ, hwy, colour = manufacturer, tintshade = model)) +
geom_point_tintshade(size = 3)
ggplot(penguins[!is.na(penguins$bill_len),]) +
geom_point_tintshade(aes(x=bill_len, y=bill_dep, fill=species, tintshade=sex),
pch=21, color="black", size=3)
Legend guide for the tintshade aesthetic
Description
A ggplot2::guide_legend() whose keys are recoloured to match the tinted
layer. The tintshade scale uses this guide by default.
Usage
guide_tintshade(
title = ggplot2::waiver(),
type = c("auto", "unique", "crossed"),
theme = NULL,
position = NULL,
direction = NULL,
override.aes = list(),
nrow = NULL,
ncol = NULL,
reverse = FALSE,
order = 0,
...
)
Arguments
title |
Legend title. Defaults to the mapped variable name. |
type |
How to colour the legend keys:
|
theme |
A |
position |
A character string indicating where the legend should be placed relative to the plot panels. One of "top", "right", "bottom", "left", or "inside". |
direction |
A character string indicating the direction of the guide. One of "horizontal" or "vertical". |
override.aes |
A list specifying aesthetic parameters of legend key. See details and examples. |
nrow, ncol |
The desired number of rows and column of legends respectively. |
reverse |
logical. If |
order |
positive integer less than 99 that specifies the order of this guide among multiple guides. This controls the order in which multiple guides are displayed, not the contents of the guide itself. If 0 (default), the order is determined by a secret algorithm. |
... |
Additional arguments passed on to |
Value
A guide object.
See Also
Examples
library(ggplot2)
df <- expand.grid(hue = c("good", "bad"), level = c("lo", "hi"))
df$y <- 1
ggplot(df, aes(hue, y, fill = hue, tintshade = level)) +
geom_col_tintshade(position = "dodge") +
guides(tintshade = guide_tintshade(type = "crossed"))
Lightness (tintshade) scales
Description
Map a variable to a lightness tint. The mapped value runs from 0 (black)
through 0.5 (the base hue) to 1 (white); the geom rescales these within
each hue group so the ramp restarts per group.
Usage
scale_tintshade_discrete(
...,
range = c(0.2, 0.8),
aesthetics = "tintshade",
guide = guide_tintshade()
)
scale_tintshade_continuous(
...,
range = c(0.2, 0.8),
aesthetics = "tintshade",
guide = guide_tintshade()
)
Arguments
... |
Passed to |
range |
Numeric length-2 output range within |
aesthetics |
Aesthetic this scale applies to. Defaults to |
guide |
The legend guide. Defaults to |
Value
A ggplot2 scale object.
See Also
Examples
library(ggplot2)
df <- data.frame(x = 1:3, y = 1:3, g = "a", item = c("lo", "mid", "hi"))
ggplot(df, aes(x, y, colour = g, tintshade = item)) +
geom_point_tintshade(size = 4) +
scale_tintshade_discrete(range = c(0.1, 0.9))