Skip to content

Commit

Permalink
add option to change the text angle
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosbosse committed Mar 24, 2021
1 parent d7c3ea7 commit 8437a56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ correlation_plot <- function(scores,
#' \code{NULL}
#' @param ncol Number of columns for facet wrap. Only relevant if
#' \code{facet_formula} is given and \code{facet_wrap_or_grid == "facet_wrap"}
#' @param x_text_angle Angle for the text on the x-axis. Default is 90
#' @param xlab Label for the x-axis. Default is the variable name on the x-axis
#' @param ylab Label for the y-axis. Default is "WIS contributions"
#' @return A ggplot2 object showing a contributions from the three components of
Expand Down Expand Up @@ -313,6 +314,7 @@ wis_components <- function(scores,
scales = "free_y",
ncol = NULL,
facet_wrap_or_grid = "facet_wrap",
x_text_angle = 90,
xlab = x,
ylab = "WIS contributions") {

Expand All @@ -336,7 +338,8 @@ wis_components <- function(scores,
ggplot2::labs(x = xlab, y = ylab) +
ggplot2::theme_light() +
ggplot2::theme(panel.spacing = ggplot2::unit(4, "mm"),
axis.text.x = ggplot2::element_text(angle = 90, vjust = 1,
axis.text.x = ggplot2::element_text(angle = x_text_angle,
vjust = 1,
hjust=1))

if (!is.null(facet_formula)) {
Expand Down
3 changes: 3 additions & 0 deletions man/wis_components.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8437a56

Please sign in to comment.