Skip to content

The I function does not work as expected on categorical y axis and numeric x axis #6308

Closed
@davidhodge931

Description

@davidhodge931

Note behaviour of the annotated label in p2 below. I would have expected it to match that in p1

library(tidyverse)
library(palmerpenguins)
library(patchwork)

p1 <- penguins |>
  ggplot() +
  geom_point(
    aes(x = flipper_length_mm, 
        y = body_mass_g),
  ) +
  annotate("label", x = I(0.2), y = I(0.8), label = "Here")

p2 <- penguins |> 
  ggplot() +
  geom_bar(
    aes(y = sex, fill = species), position = "dodge",
  ) +
  annotate("label", x = I(0.2), y = I(0.8), label = "Here") 

p1 + p2
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions