【发布时间】:2016-03-27 13:36:43
【问题描述】:
我怎样才能有一个只有一个类别的图例部分?我试图弄乱override.aes,但没有成功。或者,可以将所需的输出视为只有形状但没有比例的图例。
ggplot(iris) +
geom_point(aes(x=Sepal.Width, y=Sepal.Length, color=Species, size=Sepal.Length))+
scale_size_continuous("Legend with \n only 1 circle ",range = c(5,10))+
guides(size = guide_legend( override.aes=list(range= c(1,5))))
product 类型的插图我正在尝试访问:
点已按比例缩放,但图例未报告比例。
【问题讨论】:
-
我没有完整的答案,但这可能会帮助您入门。我绘制了一个额外的 geom_point() (从 iris 的第一行) ggplot(iris) + geom_point(aes(x=Sepal.Width, y=Sepal.Length, color=Species), size=2)+ scale_size_continuous("Legend with \n 仅 1 个圆 ", label="") + geom_point(data=test, aes(x=Sepal.Width, y=Sepal.Length, size=Sepal.Length),color='red') + guides(size = guide_legend(override.aes = list(size = 3)))