这段R代码生成一个ggplot2图表,其中图例键包含以红色、蓝色和绿色重复出现的字母"a"。
x <- rnorm(9); y <- rnorm(9); s <- rep(c("F","G","K"), each = 3)
df <- data.frame(x, y, s)
require(ggplot2)
ggplot(df, aes(x = x, y = y, col = s, label = s)) +
geom_text() +
scale_colour_discrete(name = "My name", breaks = c("F","K","G"), labels = c("Fbig","Kbig","Gbig"))
我希望在图例中用“F”、“K”和“G”来代替重复出现的“a”,请问这个有可能吗?谢谢。