Skip to content

Commit

Permalink
fix: y_orig -> y_original
Browse files Browse the repository at this point in the history
y_orig overlapped with ggrepels syntax
  • Loading branch information
dzhang32 committed Aug 18, 2024
1 parent 918ed25 commit 1618984
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 444 deletions.
12 changes: 6 additions & 6 deletions R/geom_junction.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
))
}

Expand Down

This file was deleted.

Loading

0 comments on commit 1618984

Please sign in to comment.