Skip to content

expand does not work in scale_colour_gradientn #5698

@davidhodge931

Description

@davidhodge931

Likewise, doesn't seem to do anything in scale_colour_stepsn

Tested in DEV version and 3.4.4.

library(tidyverse)
library(palmerpenguins)

p <- penguins |>
  ggplot() +
  geom_point(aes(x = flipper_length_mm,
                 y = body_mass_g,
                 col = bill_length_mm,)) +
  scale_colour_gradientn(colors = viridis::viridis(9))

p
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_point()`).

p +
  scale_colour_gradientn(colors = viridis::viridis(9), expand = c(0.5, 0.5))
#> Scale for colour is already present.
#> Adding another scale for colour, which will replace the existing scale.
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_point()`).

Created on 2024-02-22 with reprex v2.1.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions