scale_gradient: Scale gradient for ggplot2

View source: R/gradient_scale.R

scale_gradientR Documentation

Scale gradient for ggplot2

Description

Depending on min and max will apply gradient to the plot if min < 0, use 3 colours and set limits to -max_val, +max_val else use 2 colours and set limits to 0, max

Alternative dark red-blue: c("#750e13", "#ffffff", "#003a6d") Alternative violet-green: c("#491d8b", "#ffffff", "#004144")

Usage

scale_gradient(
  min,
  max,
  aesthetics = "fill",
  gradient = c("#D62929", "#ffffff", "#2982D6"),
  na.value = "#dddddd"
)

Arguments

min

Minimal value in the data

max

Maximal value in the data

aesthetics

"colour" or "fill" or both

gradient

A vector of 3 colours: low, middle and high

na.value

What colour to put on the na.value

Value

a scale_fill_gradient


JokingHero/rxtras documentation built on April 1, 2024, 12:42 p.m.