[英]Change title in ggplot legend and update marker notation
您还可以使用scale_colour_discrete
函数的name
和guide
参数来做到这一点:
library(ggplot2)
ggplot(mtcars, aes(x = hp, y = qsec, col = as.factor(cyl)))+
geom_point() +
scale_colour_discrete(name = "Whatever I please",
guide = guide_legend(override.aes = list(size = 10)))
主题函数的legend.title
参数仅接受element_text
值(因此您的“随便我做什么”将不起作用),并且主要用于更改图例标题的字体相关方面,而不是文本本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.