微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

更改颜色 r 中的 ggally ggparcoord 图

如何解决更改颜色 r 中的 ggally ggparcoord 图

ggparcoord(data = df,columns = 1:4,mapping=aes(color=as.factor(Species)))+
  scale_color_discrete("Species",labels=levels(df$Species))

如何将此图的标准颜色更改为 stesoa=black、versicolor=green 和 virginica=mageanta?

解决方法

您可以使用 scale_color_manual() 设置自定义颜色:

ggparcoord(df,columns = 1:4,mapping = aes(color = as.factor(Species))) +
  scale_color_manual("Species",values = c("black","green","magenta"),labels = levels(df$Species))

custom colors

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。