使用 ggscatter 分组着色

问题描述 投票:0回答:0

我想在这个情节上给我的点上色:

q <- ggscatter(ARAL_R, x = "Intl1", y = "Sul1", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "spearman", xlab = "Intl1 (copies/g)", ylab = "Sul1 (copies/g)") + stat_cor(label.y = 1, label.x.npc = "center") + stat_regline_equation(label.y = 0.5, label.x.npc = "center")

但是每当我添加命令

color = "Core"
fill = "Core"
(其中 A 是 5 的分类变量)时,就会发生这种情况:

q <- ggscatter(ARAL_R, x = "Intl1", y = "Sul1", color = "Core", add = "reg.line", conf.int = TRUE, cor.coef = TRUE, cor.method = "spearman", xlab = "Intl1 (copies/g)", ylab = "Sul1 (copies/g)") + stat_cor(label.y = 1, label.x.npc = "center") + stat_regline_equation(label.y = 0.5, label.x.npc = "center")
ggpar(q, xscale = "log10", yscale = "log10")

我想做成这样:

但是与长矛手的相关线。

我做错了什么?

r ggplot2 scatter-plot
© www.soinside.com 2019 - 2024. All rights reserved.