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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2 - -3 - -5 - -6 - -7 - -8 - - - -SOD1-201 -SOD1-202 - - - - - - - -31660000 -31662000 -31664000 -31666000 -31668000 -transcript_name -Base geom_junction_label_repel plot - - 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2 - -3 - -5 - -6 - -7 - -8 - - - -SOD1-201 -SOD1-202 - - - - - - - -31660000 -31662000 -31664000 -31666000 -31668000 -transcript_name - -transcript_name - - - -a - - - -a -SOD1-201 -SOD1-202 -With aes geom_junction_label_repel plot - - 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2 - -6 - -8 - - - - - - - - - - - - - - - - - - - -3 - -5 - -7 - - - - - - - - - - - -SOD1-201 - - - - - - - - - - -SOD1-202 - - - - - - - -31660000 -31662000 -31664000 -31666000 -31668000 - - - - - -31660000 -31662000 -31664000 -31666000 -31668000 -SOD1-201 -SOD1-202 - - -transcript_name -With facet geom_junction_label_repel plot - - 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1 - -2 - -3 - -4 - -5 - -6 - -7 - -8 - - - -SOD1-201 -SOD1-202 - - - - - - - -31660000 -31662000 -31664000 -31666000 -31668000 -transcript_name -With param geom_junction_label_repel plot - -