From 16189845fffc8404b00053aabeb05b24f8096483 Mon Sep 17 00:00:00 2001
From: David Zhang <32676710+dzhang32@users.noreply.github.com>
Date: Sun, 18 Aug 2024 21:39:11 +0100
Subject: [PATCH] fix: y_orig -> y_original
y_orig overlapped with ggrepels syntax
---
R/geom_junction.R | 12 +-
...ase-geom-junction-label-repel-plot.new.svg | 76 -----------
.../base-geom-junction-label-repel-plot.svg | 42 +++----
...aes-geom-junction-label-repel-plot.new.svg | 88 -------------
...ith-aes-geom-junction-label-repel-plot.svg | 50 ++++----
...cet-geom-junction-label-repel-plot.new.svg | 119 ------------------
...h-facet-geom-junction-label-repel-plot.svg | 36 +++---
...ram-geom-junction-label-repel-plot.new.svg | 82 ------------
8 files changed, 61 insertions(+), 444 deletions(-)
delete mode 100644 tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.new.svg
delete mode 100644 tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.new.svg
delete mode 100644 tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.new.svg
delete mode 100644 tests/testthat/_snaps/geom_junction_label_repel/with-param-geom-junction-label-repel-plot.new.svg
diff --git a/R/geom_junction.R b/R/geom_junction.R
index ac6c635..6288a14 100644
--- a/R/geom_junction.R
+++ b/R/geom_junction.R
@@ -256,7 +256,7 @@ GeomJunction <- ggplot2::ggproto("GeomJunction", ggplot2::GeomLine,
junction_curve <- data.frame(
x_points = c(x, curve_points$x, xend),
y_points = c(y, curve_points$y, y),
- y_orig = y
+ y_original = y
) %>%
dplyr::rename(
x = x_points,
@@ -282,17 +282,17 @@ GeomJunction <- ggplot2::ggproto("GeomJunction", ggplot2::GeomLine,
# then divided by the sf, setting the max y
if (junction.orientation == "top") {
junctions <- junctions %>% dplyr::mutate(
- y = ifelse(y == y_orig, y, y_orig + (y / max(y)) / sf)
+ y = ifelse(y == y_original, y, y_original + (y / max(y)) / sf)
)
} else if (junction.orientation == "bottom") {
junctions <- junctions %>% dplyr::mutate(
- y = ifelse(y == y_orig, y, y_orig - (y / max(y)) / sf)
+ y = ifelse(y == y_original, y, y_original - (y / max(y)) / sf)
)
} else if (junction.orientation == "alternating") {
junctions <- junctions %>% dplyr::mutate(y = dplyr::case_when(
- y == y_orig ~ y,
- junction_index %% 2 == 0 ~ y_orig - (y / max(y) / sf),
- junction_index %% 2 == 1 ~ y_orig + (y / max(y) / sf)
+ y == y_original ~ y,
+ junction_index %% 2 == 0 ~ y_original - (y / max(y) / sf),
+ junction_index %% 2 == 1 ~ y_original + (y / max(y) / sf)
))
}
diff --git a/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.new.svg b/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.new.svg
deleted file mode 100644
index f991064..0000000
--- a/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.new.svg
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.svg b/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.svg
index c29a1a9..e1f1200 100644
--- a/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.svg
+++ b/tests/testthat/_snaps/geom_junction_label_repel/base-geom-junction-label-repel-plot.svg
@@ -35,30 +35,24 @@
-
-
-
-
-
-
-
-
-
-1
-
-2
-
-3
-
-4
-
-5
-
-6
-
-7
-
-8
+
+
+
+
+
+
+
+2
+
+3
+
+5
+
+6
+
+7
+
+8
diff --git a/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.new.svg b/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.new.svg
deleted file mode 100644
index 213b4b6..0000000
--- a/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.new.svg
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.svg b/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.svg
index 6370669..44eedcc 100644
--- a/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.svg
+++ b/tests/testthat/_snaps/geom_junction_label_repel/with-aes-geom-junction-label-repel-plot.svg
@@ -35,30 +35,24 @@
-
-
-
-
-
-
-
-
-
-1
-
-2
-
-3
-
-4
-
-5
-
-6
-
-7
-
-8
+
+
+
+
+
+
+
+2
+
+3
+
+5
+
+6
+
+7
+
+8
@@ -81,12 +75,12 @@
transcript_name
-
-a
+
+a
-
-a
+
+a
SOD1-201
SOD1-202
With aes geom_junction_label_repel plot
diff --git a/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.new.svg b/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.new.svg
deleted file mode 100644
index 4703f70..0000000
--- a/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.new.svg
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.svg b/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.svg
index 184a79c..939dd45 100644
--- a/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.svg
+++ b/tests/testthat/_snaps/geom_junction_label_repel/with-facet-geom-junction-label-repel-plot.svg
@@ -32,17 +32,14 @@
-
-
-
+
+
2
-
-4
-
-6
-
-8
+
+6
+
+8
@@ -58,18 +55,15 @@
-
-
-
-
-
-1
-
-3
-
-5
-
-7
+
+
+
+
+3
+
+5
+
+7
diff --git a/tests/testthat/_snaps/geom_junction_label_repel/with-param-geom-junction-label-repel-plot.new.svg b/tests/testthat/_snaps/geom_junction_label_repel/with-param-geom-junction-label-repel-plot.new.svg
deleted file mode 100644
index a41468d..0000000
--- a/tests/testthat/_snaps/geom_junction_label_repel/with-param-geom-junction-label-repel-plot.new.svg
+++ /dev/null
@@ -1,82 +0,0 @@
-
-