user2300940
user2300940

Reputation: 2385

stat_cor label not correctly positioned across facets

I want my corr-values to be positioned as close to the facet as possible. Now, some labels are positioned lower than other. 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")

Upvotes: 1

Views: 6514

Answers (1)

Roman
Roman

Reputation: 17648

You can try 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

Upvotes: 4

Related Questions