Skip to contents

Color scale for continuous data

Usage

v_scale_colour_gradient(
  vc,
  name = NULL,
  low = "#132B43",
  high = "#56B1F7",
  limits = NULL,
  position = c("right", "bottom", "left", "top"),
  align = c("middle", "start", "end")
)

v_scale_fill_gradient(
  vc,
  name = NULL,
  low = "#132B43",
  high = "#56B1F7",
  limits = NULL,
  position = c("right", "bottom", "left", "top"),
  align = c("middle", "start", "end")
)

Arguments

vc

An htmlwidget created with vchart() or specific chart's type function.

name

Title for the legend.

low, high

Colours for low and high ends of the gradient.

limits

Limits of the scale, default (NULL) is to use the default scale range of the data.

position

Position of the legend.

align

Alignment of the legend.

Value

A vchart() htmlwidget object.

Examples


library(vchartr)
data("penguins", package = "palmerpenguins")

vchart(penguins) %>%
  v_scatter(aes(
    x = bill_length_mm, 
    y = bill_depth_mm,
    color = body_mass_g
  )) %>% 
  v_scale_colour_gradient(
    name = "Body mass",
    low = "yellow",
    high = "red"
  )