r - multiple legends setting legend key circle color -


i have plot:

dates = c("2017-03-13","2017-03-13","2017-03-14","2017-03-14","2017-03-14") value = c(5,6,7,8,9) group = c("a","b","a","b","c") size = c(10,20,30,40,50) data =data.frame(dates= dates, value = value, group = group, size = size) ggplot(data, aes(x = dates, y = value, group = group)) + geom_point(aes (color = as.factor(group), size= size ))+  scale_color_manual(name="group",                      labels = c(a="a",b= "b",c = "c"),                      values = c(a="green",b="red" , c = "orange" )   ) + theme(     panel.background = element_rect(fill = "black", colour = "black"),     legend.key = element_rect(colour = "black", fill = "black")   ) 

there 2 issues:

(1) in size legend circle black , background black. how make color of circle red can see circles on black background?

you need override.aes in guide_legend change aesthetic settings in legend without changing plot.

+ guides(size = guide_legend(override.aes = list(color = "red"))) 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -