From 888f9fa0ea5be86f05f6f3376b12fe9f037b5dca Mon Sep 17 00:00:00 2001
From: SamCH93 <samuel.pawel@gmail.com>
Date: Thu, 15 Dec 2022 11:03:45 +0100
Subject: [PATCH] mark discrepant studies

---
 rsAbsence.Rnw | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/rsAbsence.Rnw b/rsAbsence.Rnw
index 4ff1fa1..d1732b1 100755
--- a/rsAbsence.Rnw
+++ b/rsAbsence.Rnw
@@ -71,6 +71,7 @@ Reproducibility <- TRUE
 ## packages
 library(ggplot2) # plotting
 library(dplyr) # data manipulation
+library(ggrepel) # to highlight data points with non-overlapping labels
 
 ## the replication Bayes factor under normality
 BFr <- function(to, tr, so, sr) {
@@ -261,7 +262,11 @@ pbreaks <- c(0.005, 0.02, 0.05, 0.15, 0.4)
 ggplot(data = rpcbNull, aes(x = po, y = po2)) +
     geom_abline(intercept = 0, slope = 1, alpha = 0.2) +
     geom_vline(xintercept = 0.05, alpha = 0.2, lty = 2) +
-    geom_point() +
+    geom_hline(yintercept = 0.05, alpha = 0.2, lty = 2) +
+    geom_point(alpha = 0.8, shape = 21, fill = "darkgrey") +
+    geom_label_repel(data = filter(rpcbNull, po2 < 0.05),
+                     aes(x = po, y = po2, label = id), alpha = 0.8, size = 3,
+                     min.segment.length = 0, box.padding = 0.7) +
     labs(x = bquote(italic(p["o"]) ~ "(reported)"),
          y =  bquote(italic(p["o"]) ~ "(recomputed under normality)")) +
     scale_x_log10(breaks = pbreaks, label = scales::percent) +
-- 
GitLab