Skip to content

Commit

Permalink
Remove redundancy in x axis of schematic line plots
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidasilvaf committed Feb 15, 2024
1 parent 9294786 commit 7f84f16
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,12 @@ partition_lineplots <- function(
geom_line(color = palette[x], linewidth = 1) +
geom_point(size = 2, color = "gray20") +
theme_bw() +
labs(x = "", y = "", subtitle = subtitle) +
labs(x = NULL, y = NULL, subtitle = subtitle) +
theme(
panel.grid.minor = element_blank(),
axis.text.x = element_text(size = 11, face = "bold"),
axis.text.y = element_blank()
axis.text.y = element_blank(),
axis.ticks.y = element_blank()
) +
ylim(c(0, 4)) +
scale_x_discrete(
Expand Down
9 changes: 8 additions & 1 deletion R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ plot_expression_partitions <- function(
#' partition next to explanatory line plots depicting each partition.
#'
#' @importFrom ggplot2 geom_bar coord_flip scale_x_discrete geom_text
#' scale_y_continuous
#' scale_y_continuous unit
#' @export
#' @rdname plot_partition_frequencies
#' @examples
Expand Down Expand Up @@ -225,6 +225,13 @@ plot_partition_frequencies <- function(
labels = labels
)

np <- ifelse(group_by == "Category", 10, 4)
p_line[seq_len(np)] <- lapply(p_line[seq_len(np)], function(x) {
p <- x +
theme(axis.text.x = element_blank(), axis.ticks.x = element_blank())
return(p)
})

# Combine plots
ncols <- ifelse(group_by == "Category", 2, 1)
p_final <- wrap_plots(
Expand Down

0 comments on commit 7f84f16

Please # to comment.