2

I would like to make the shape that shows the bubble color larger in the legend only. I have tried several suggestions from this site, but I have been unlucky so far. A basic example is below.

In this example, I would like for the "gear" size to be 10. This is probably too large, but I wanted to verify it was working first.

library(ggplot2)
ggplot(mtcars
       ,aes(x=hp, y=disp, size=mpg, fill=factor(gear)))+
geom_point(shape=21)+
theme_bw()+
scale_size_continuous(range=c(2,15))+
guides(shape = guide_legend(override.aes = list(size = 10)))

MT Cars Plot Plot Output

Thomas Fritsch
  • 8,893
  • 33
  • 34
  • 46
Matt
  • 154
  • 1
  • 1
  • 12

1 Answers1

2

Changing shape to fill in guides will re-scale the size of that element of the legend:

 guides(fill = guide_legend(override.aes = list(size = 10)))
Mako212
  • 6,318
  • 1
  • 16
  • 32