continuous_scale_asym: Continuous scale constructor for 'ggasym'

Description Usage Arguments Examples

View source: R/scale_continuous_asym.R

Description

This is a this wrapper around continuous_scale() from the 'ggplot2' package. It is generally best to call this function implicitly using one of the wrappers that have the general naming scheme of scale_*_tl/br_*() (such as scale_fill_tl_gradient()).

Usage

1
continuous_scale_asym(aesthetics, scale_name, palette, na.value, guide, ...)

Arguments

aesthetics

The names of the aesthetics that this scale works with

scale_name

The name of the scale

palette

A palette function that when called with a numeric vector with values between 0 and 1 returns the corresponding values in the range the scale maps to.

na.value

Missing values will be replaced with this value.

guide

A function used to create a guide or its name. See guides() for more info.

...

other input is passed on to ggplot2::continuous_scale(); see ?ggplot2::continuous_scale for complete documentation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(tibble)
library(ggplot2)
tib <- tibble(
  g1 = c("A", "A", "B"),
  g2 = c("B", "C", "C"),
  val_1 = c(1, 2, 3),
  val_2 = c(-1, 0, 1)
)

tib

tib <- asymmetrise(tib, g1, g2)
ggplot(tib) +
  geom_asymmat(aes(x = g1, y = g2, fill_tl = val_1, fill_br = val_2)) +
  scale_fill_tl_gradient(low = "lightpink", high = "tomato") +
  scale_fill_br_gradient(low = "lightblue1", high = "dodgerblue") +
  labs(fill_tl = "top-left fill", fill_br = "bottom-right fill")

ggasym documentation built on May 16, 2021, 1:07 a.m.