0

in ggplot2 , there are two legend , i want to delete legend 'size', it's seems "position='none'" not work. anyone can help ? Thanks!

enter image description here

library(tidyverse)
plot_data <- data.frame(category=rep(letters[1:5],10),
                        amount=rep(rnorm(5),10))

plot_data %>% group_by(category) %>% summarise(sales=sum(amount)) %>% 
  arrange(-sales) %>% mutate(category=fct_inorder(category))%>% 
  ggplot(aes(x=category,y=sales))+
  geom_bar(stat='identity',aes(fill=category))+
  geom_text(aes(label=round(sales,0.1),size=abs(sales)))+
  theme(legend.position ="top")+
  guides(size=guide_legend(title='size',position='none'))
anderwyang
  • 1,801
  • 4
  • 18

0 Answers0