嗨,我有以下东西
ggplot(df, aes(x= nlk_percent ,y= c_percent, color=nlk)) +
geom_point(position = position_jitter(width = 0.05, height = 0), size=7, alpha=.3) +
geom_smooth(method=lm
, se=FALSE
, fullrange=TRUE
)+
theme_classic() +
stat_cor(
method = "pearson", label.x.npc = .65, label.y.npc = 0
)
this produces the following plot,
然而,即使我将labe.y.npc设置为0或"Bottom",标签也会保持在中间.有没有什么办法来解决这个问题?我想把这个放在情节的右下角.
提前谢谢你.
这是数据框.
df=structure(list(nlk = c("nlk_active", "nlk_rest", "nlk_active",
"nlk_rest", "nlk_rest", "nlk_active", "nlk_rest", "nlk_active",
"nlk_active", "nlk_rest", "nlk_active", "nlk_rest", "nlk_rest",
"nlk_active", "nlk_rest", "nlk_active", "nlk_active", "nlk_rest",
"nlk_active", "nlk_rest", "nlk_rest", "nlk_active"), nlk_percent = c(3.18269229751619,
4.82171021503467, 2.29865831556452, 3.65306001710456, 5.61618123133188,
3.35895882583233, 5.23610988988963, 3.10768786931437, 4.72410451986685,
5.55642941544957, 2.88752527074159, 4.08406426478847, 5.69209237542757,
3.64270157183323, 5.73335434061383, 3.99367436175058, 2.52857131887076,
6.01100356443267, 3.79493566280354, 4.67016051412663, 4.73822740036724,
3.96993327469786), c_percent = c(4.18507363787676, 4.18507363787676,
1.13750352374994, 1.13750352374994, 3.35049724708413, 3.35049724708413,
3.12928301694497, 3.12928301694497, 2.59215800212536, 2.59215800212536,
0.263034405833794, 0.263034405833794, 5.05093696522523, 5.05093696522523,
4.41751500288509, 4.41751500288509, 4.60880924267552, 4.60880924267552,
0.748461233004036, 0.748461233004036, 0.124328135002202, 0.124328135002202
)), row.names = c(1L, 3L, 6L, 8L, 10L, 12L, 14L, 16L, 18L, 20L,
21L, 23L, 25L, 27L, 29L, 31L, 34L, 36L, 37L, 39L, 42L, 44L), class = "data.frame")