问题描述
假设我在ggplot2中绘制一个数据框,如下所示: ggplot(iris)+ geom_point(aes(x = Sepal .Width,y = Sepal.Length,color = Species,size = Sepal.Length))
相关问题:
-
如何从图例中完全删除一个变量?例如,仍然按照
Sepal.Length
的大小分类,但是从图例中删除Sepal.Length
? -
如何从图例中删除某个值或一组值?例如,仍按上面的Species颜色点,但在图例中只显示
setosa
的值,并排除versicolor,virginica $ c
-
正如joran所述,使用
scale_size(guide =none)
。 -
scale_color_discrete(breaks =setosa)
how can I remove a variable altogether from the legend? For example, still size the points by
Sepal.Length
but removeSepal.Length
from the legend altogether?how can I remove just a certain value or set of values from the legend? For example, still color the points by Species as above, but in the legend only show the value for
setosa
and excludeversicolor, virginica
?As commented by joran, use
scale_size(guide = "none")
.scale_color_discrete(breaks="setosa")
谢谢。
suppose I'm plotting a dataframe in ggplot2 like:
ggplot(iris) + geom_point(aes(x=Sepal.Width, y=Sepal.Length, color=Species, size=Sepal.Length))
two related questions:
thanks.
这篇关于从ggplot2中删除某些图例变量和图例值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!