stat_cor标签未正确跨面定位

时间:2018-10-31 12:22:36

标签: r ggplot2

我希望我的corr值尽可能地靠近刻面。现在,某些标签的位置比其他标签低。 enter image description here

ggplot(df, aes(x, y)) +
    geom_point(alpha=0.8) + stat_cor(method = "pearson",size=2.5) +
    facet_wrap(~ miRNA + SYMBOL,ncol=4, scales="free") +
    theme_bw(base_size = 8)  +
    geom_smooth(method = lm, fill = "lightgray")

1 个答案:

答案 0 :(得分:1)

您可以尝试label.*.npc

ggplot(mtcars, aes(cyl , disp)) +
  geom_point(alpha=0.8) + 
  stat_cor(label.y.npc="top", label.x.npc = "left", method = "pearson",size=2.5) +
  facet_wrap(~ vs ,scales="free") +
  geom_smooth(method = lm, fill = "lightgray")

enter image description here