Skip to contents

Due to the peculiar nature of the colormeter legend (e.g., dynamic size and positioning of color bars/arcs depending on the number of breaks), many parts of the legend are drawn in a mini isolated coordinate space. You can inspect this coordinate space with debug = TRUE.

The coordinate space defaults to the x-y range of the legend "data", which considers the polar-transformed positioning of the color arcs/bars, the labels, and the dashboard circle.

Examples

library(ggplot2)
# A standard plot
p <- ggplot(mtcars, aes(drat, hp)) +
  geom_point(aes(color = mpg))
# Colormeter guide for color scale
p +
  scale_color_viridis_c(
    option = "inferno",
    breaks = scales::breaks_pretty(10),
    guide = guide_colormeter(debug = TRUE)
  )