Overriding the legend title using user specified string instead of variable name -
i have below code using ggplot2() package. trying plot between variables - 'company advertising' , 'brand revenue' of data frame 'htmltable' , when variable 'industry' 'luxury'; using ggplot() function. using variable of data frame 'brand value' colour variable.
p<- ggplot(htmltable[htmltable$industry='luxury',],aes(x='companyadvertising',y='brandrevenue') q <- p+geom_point(aes(color='brandvalue',size='brandvalue') + geom_text(label='brand') r <- q+xlab("company advertisiment in billions")+ylab("brand revenue in billions") +ggtitle("luxury") r+theme(plot.title=element_text(size=10,face='bold'),legend.key=element_rect(fill='light blue'))
here, want change legend title "brandvalue" "brandvalue in billions". please suggest.
i tried using labs parameter in below statement. resulting in 2 legends.
r <- q+xlab("company advertisiment in billions")+ylab("brand revenue in billions") +ggtitle("luxury")+labs(colour="brandvalue in billions")
have tried ?
+labs(colour="brandvalue in billions", size="brandvalue in billions")
Comments
Post a Comment