Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在 R 中的箱线图中以相同颜色为某些类别着色,但不知道该怎么做。有 8 个类别,我需要其中 4 个是一种颜色,2 个是另一种颜色,剩下的两个是一种颜色。我遇到的问题是它们不按顺序排列,即 1,5-一种颜色,3,4,6,8 一种颜色,然后是 7-一种颜色和 2-一种颜色。有什么帮助吗??????
您可以将col参数用于boxplot:
col
boxplot
boxplot(count~spray, data=InsectSprays, col=c("white", "green", "green", "white", "blue", "yellow"))