如何解决仅将标签上的颜色添加到ggplot R的geom_text中
我尝试只在标签上加上颜色
此代码有效
ggplot(cmd2,aes(V1,V2)) + geom_point(mapping = aes(x = V1,y = V2,shape=Treatment,color=Concentration),size=2) + scale_color_gradient(low = "blue",high = "red")+
coord_fixed() +
geom_segment(data = vec.sp.df,aes(x = 0,xend = V1,y = 0,yend = V2),arrow = arrow(length = unit(0.01,"mm")),colour = "grey") +
geom_text(data = vec.sp.df,aes(x = V1,label = ASV),size = 3)+
geom_label_repel(aes(label = Sample),size=2.5,label.size = NA,fill = NA,colour = "grey")
但是当我在geom_text上添加列表以添加颜色时,出现此错误
legend_final <- as.vector(as.character(df_legend$phylum))
ggplot(cmd2,high = "red")+
coord_fixed() +
geom_segment(data = vec.sp.df,colour = "grey") +
geom_text(data = vec.sp.df,label = ASV,colour = legend_final),size = 3)+
geom_label_repel(aes(label = Sample),colour = "grey")
Error
Error: Discrete value supplied to continuous scale
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。