相关疑难解决方法(0)

将geom_text的默认"a"图例更改为标签字符串本身

此问题类似,我想更改图例中的默认"a",而不是完全删除它,我想用标签本身替换它.也就是说,图例的第一行应该有一个标有"se"的彩色图标,右边是全名"setosa".

iris$abbrev = substr( iris$Species, 1, 2 )

ggplot(data = iris, aes(x = Sepal.Length, y=Sepal.Width, shape =
Species, colour = Species)) +  geom_text(aes(label = abbrev))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

r legend ggplot2 geom-text

16
推荐指数
2
解决办法
384
查看次数

标签 统计

geom-text ×1

ggplot2 ×1

legend ×1

r ×1