Skip to content

NA drops out of the legend where a named pal is added to scale_colour_manual #5214

Closed
@davidhodge931

Description

@davidhodge931
library(tidyverse)
library(palmerpenguins)

penguins |>
  ggplot() +
  geom_point(aes(
    x = bill_depth_mm, 
    y = body_mass_g, 
    col = sex
  )) +
  scale_color_manual(values = c("red", "blue"))
#> Warning: Removed 2 rows containing missing values (`geom_point()`).

penguins |>
  ggplot() +
  geom_point(aes(
    x = bill_depth_mm, 
    y = body_mass_g, 
    col = sex
  )) +
  scale_color_manual(values = c("male" = "red", "female" = "blue"))
#> Warning: Removed 2 rows containing missing values (`geom_point()`).

Created on 2023-03-03 with reprex v2.0.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions