ggplot2图例只有一个类别/只有形状而没有比例

GPi*_*rre 6 maps r ggplot2

如何只有一个类别的图例部分?我试图搞砸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)))) 
Run Code Online (Sandbox Code Playgroud)

此搜索

我试图获得的产品类型的说明:MAP2

点会缩放,但图例不会报告比例.

chr*_*oph 5

只需break在比例尺中创建一个.您也可以为其添加自定义标签(此处为"").您还可以使用所选的中断控制图例中点的大小.

scale_color_discrete()条线是在那里,因为否则1点传奇将在顶部,而不是你想要的图片.

require(ggplot2)
g <- ggplot(iris) + geom_point(aes(x = Sepal.Width, y = Sepal.Length,
                                   color = Species, size = Sepal.Length)) +
  scale_color_discrete(name = "Color") +
  scale_size_continuous(name = "Legend with \n only 1 circle",
                        breaks = 5, labels = "")
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述