Skip to content

Bug where ggplot2.discrete.colour options set and then colour scale with limits applied  #5980

Closed
@davidhodge931

Description

@davidhodge931

Not sure if I've misunderstood something, but I would expect this to work...

library(tidyverse)
library(palmerpenguins)

options(ggplot2.discrete.colour = function() ggplot2::scale_colour_viridis_d())

penguins |> 
  ggplot() +
  geom_point(
    aes(x = flipper_length_mm, 
        y = body_mass_g, 
        colour = species)
  ) +
  scale_colour_discrete(limits = c("Adelie", "Chinstrap"))
#> Error in (function () : unused argument (limits = c("Adelie", "Chinstrap"))

Created on 2024-07-08 with reprex v2.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions