与此问题类似,我想更改图例中的默认"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)