Skip to content

Instantly share code, notes, and snippets.

@mkuhn
Created June 30, 2021 08:24
Show Gist options
  • Save mkuhn/730f54cda61eea5384f07a9a0445f707 to your computer and use it in GitHub Desktop.
Save mkuhn/730f54cda61eea5384f07a9a0445f707 to your computer and use it in GitHub Desktop.
Hollow circles for size legend
library(tidyverse)

set.seed(23)

d <- tibble(x = rnorm(10), y = rnorm(10), a = rep(c("x", "y"),5), b = rep(1:5, 2))

d %>% 
  ggplot(aes(x, y, color = a, size = b)) + geom_point() +
  guides(colour = guide_legend(order = 1), 
         size = guide_legend(order = 2, override.aes = list(shape = 21, stroke = 0.5)))

Created on 2021-06-30 by the reprex package (v2.0.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment