Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geom_circle appearance in legend #267

Open
SchmidtPaul opened this issue Jul 21, 2022 · 1 comment
Open

geom_circle appearance in legend #267

SchmidtPaul opened this issue Jul 21, 2022 · 1 comment
Labels
feature a feature request or enhancement

Comments

@SchmidtPaul
Copy link

Sorry - I know this is not a bug, but I'd like your opinion on it anyway. The reprex below shows how I would use geom_circle to draw a circle around some but not all geom_point. As far as I know, the legend will always show a rectanlge around the symbols, yet it would be nice if it would actually be a circle. I don't think I can approach this with guide() or theme(legend.key = ). Can you think of a solution?

library(ggforce)

dat <- data.frame(
  x = c(1, 1.3, 1.6),
  y = c(1, 1, 1),
  circle = c("yes", "no", "no")
)

ggplot() +
  coord_equal() +
  theme_classic() +
  geom_circle(
    data = subset(dat, circle == "yes"),
    aes(x0 = x, y0 = y, r = 0.5, alpha = circle),
    fill = "grey",
    color = NA,
    show.legend = TRUE
  ) +
  geom_point(
    data = dat,
    aes(x, y, color = circle)
  ) +
  scale_color_manual(
    values = c("yes" = "blue", "no" = "red")
  ) +
  scale_alpha_manual(
    values = c("yes" = 0.25, "no" = 0)
  )

Created on 2022-07-21 by the reprex package (v2.0.1)

@thomasp85
Copy link
Owner

Thanks for the suggestion - a draw_key_circle() would make sense

@thomasp85 thomasp85 added the feature a feature request or enhancement label Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants