【发布时间】:2020-02-02 05:31:20
【问题描述】:
问题:我一直在尝试使用托盘 Wes_Anderson 给我一种物种颜色...所以第一行就是这样做的,但由于它使用的是基础 R 颜色,我无法控制它们。我正在使用 R 上的基本 Iris 数据集。
graph = plot(data$Petal.Width, data$Petal.Length, pch = 16, col =( data$Species))
我已经尝试使用这个来添加它们..
graph + scale_fill_manual (values = wes_palette("Zissou1", n = 3, type = "discrete"))
我想添加它们的原因是因为我试图指定我为下面编码的图例所做的事情。我正在努力确保该物种与我的 wes_anderson 托盘相匹配... 我不明白为什么在使用 wes_anderson 托盘时无法从 col = data$Species 列中指定颜色
legend("topleft", inset = 0.05,
legend=paste(rep(c("setosa","versicolor","virginica"))),
col = wes_palette("Zissou1", 3, type = c("discrete")),
pch = 16,
#this is for a box around the legend
bty="black")
【问题讨论】: