3

I am creating a bubble plot with ggplot where bubbles are plotted as geom_point. I have aestetic x, y, size of bubble and filling of bubble). The following creates the plot:

df = data.frame(x=c(1:100), y = rnorm(100), size = (rnorm(100))^2, label = sample(letters,100,replace = T))
ggplot(df, aes(x, y, size = size, label = label, fill = label)) + geom_point(shape=21) + 
    scale_size_area(max_size = 25)

Bubble plot with double legend

I have double legend for 1) the size of bubble and for 2) the filling of the bubble. I would like to increase 2) the size of the legend for the filling (highlighted in the picture) without changing all other properties (e.g. the legend for the size of the bubble or the plot). This is to see better the color plotted in the legend. How to accomplish this? Many thanks for any suggestion

Community
  • 1
  • 1
MasterJedi
  • 1,618
  • 1
  • 18
  • 17
  • 6
    How about `+ guides(fill = guide_legend(override.aes = list(size = 5)))`? – tonytonov Feb 19 '16 at 08:56
  • Thanks tonytonov. It is what I was looking for. Sorry for posting a *duplicated* question (although I think it was not fully duplicated as I am plotting double legend and want to change legend for fill only). Many thanks – MasterJedi Feb 22 '16 at 02:33
  • You are welcome! No worries, by marking as a duplicate I just pointed which answer would suit here. – tonytonov Feb 22 '16 at 08:12

0 Answers0