scale_color_tscv: Create a tscv color scale

View source: R/colors_tscv.R

scale_color_tscvR Documentation

Create a tscv color scale

Description

Create a ggplot2 color scale based on a predefined tscv palette.

Usage

scale_color_tscv(palette = "main", discrete = TRUE, reverse = FALSE, ...)

Arguments

palette

Character value. Name of the palette.

discrete

Logical value. If TRUE, create a discrete color scale. If FALSE, create a continuous color scale.

reverse

Logical value. If TRUE, the palette is reversed.

...

Additional arguments passed to ggplot2::discrete_scale() or ggplot2::scale_color_gradientn().

Details

scale_color_tscv() creates either a discrete or continuous color scale for the color aesthetic.

For discrete variables, the function uses ggplot2::discrete_scale(). For continuous variables, it uses ggplot2::scale_color_gradientn().

Available palettes are "main", "cool", "hot", "mixed", and "grey".

Value

A ggplot2 scale object.

See Also

Other data visualization: plot_bar(), plot_density(), plot_histogram(), plot_line(), plot_point(), plot_qq(), scale_fill_tscv(), theme_tscv(), tscv_cols(), tscv_pal()

Examples

library(dplyr)

data <- M4_monthly_data |>
  filter(series %in% c("M23100", "M14395"))

plot_line(
  data = data,
  x = index,
  y = value,
  color = series,
  title = "M4 Monthly Time Series",
  subtitle = "Selected monthly series",
  xlab = "Time",
  ylab = "Value"
) +
  scale_color_tscv(palette = "main")

tscv documentation built on May 13, 2026, 9:07 a.m.