我正在尝试使用填充和形状美学来创建绘图。情节看起来很精彩,但传说并没有被填充美学所染色。你能帮我解决一下吗?
这是一个示例代码
#Example dataset
bio_rep = rep(c(1:3), 4)
category = rep(c("w", "x", "y", "z"), each = 3)
ranking = sample(c("s","a","b","c"), 12, replace = T)
score = runif(12)
df = data.frame(bio_rep, category, ranking, score)
> df
bio_rep category ranking score
1 1 w b 0.12496463
2 2 w b 0.82229942
3 3 w b 0.20121351
4 1 x a 0.06352934
5 2 x s 0.57510752
6 3 x a 0.54471793
7 1 y a 0.87203684
8 2 y c 0.32858945
9 3 y a 0.06234144
10 1 z c 0.41124401
11 2 z s 0.62253128
12 3 z a 0.42499771
现在的情节
require(ggplot2)
ggplot(df, aes(category, score, shape = factor(bio_rep), fill = ranking))+
geom_point(size = 3)+
scale_shape_manual(values = c(21,22,23))
如您所见,排名未在图例
中着色你知道怎么解决吗?
非常感谢提前 MP