[英]Add more labels to colorbar legend in ggplot
I'm making some plots in ggplot with a colorbar legend like below. 我在ggplot中使用以下颜色条图例进行一些绘图。 By default the legend has only 4 labels showing the value of specific colors.
默认情况下,图例只有4个标签,显示特定颜色的值。 There are theme elements which can change the size of the colorbar, but not the number of labels.
有些主题元素可以更改颜色条的大小,但不能更改标签的数量。 How can I increase the number of labels?
如何增加标签数量?
library(ggplot2)
ggplot(mtcars, aes(x=mpg, y=carb, color=disp)) +
geom_point(size=3) +
theme(legend.key.height = unit(2,'cm'))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.