From 18951e9c20c0265684cec9652a677de4ceba9f71 Mon Sep 17 00:00:00 2001 From: fawda123 Date: Fri, 19 Jul 2024 10:21:16 -0400 Subject: [PATCH] add hjust, angle, and size args to show_fibmatrix for x-axis text --- R/show_fibmatrix.R | 10 +++++++--- man/show_fibmatrix.Rd | 9 +++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/R/show_fibmatrix.R b/R/show_fibmatrix.R index 9514342e0..c210cce96 100644 --- a/R/show_fibmatrix.R +++ b/R/show_fibmatrix.R @@ -7,6 +7,9 @@ #' @param asreact logical indicating if a \code{\link[reactable]{reactable}} object is returned #' @param nrows if \code{asreact = TRUE}, a numeric specifying number of rows in the table #' @param family optional chr string indicating font family for text labels +#' @param angle numeric for angle of x-axis text labels +#' @param hjust numeric for horizontal justification of x-axis text labels +#' @param size numeric for size of the x-axis text labels #' @param plotly logical if matrix is created using plotly #' @param width numeric for width of the plot in pixels, only applies of \code{plotly = TRUE} #' @param height numeric for height of the plot in pixels, only applies of \code{plotly = TRUE} @@ -40,8 +43,8 @@ show_fibmatrix <- function(fibdata, yrrng = NULL, stas = NULL, indic = NULL, threshold = NULL, lagyr = 3, subset_wetdry = c("all", "wet", "dry"), precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, - txtsz = 3, asreact = FALSE, nrows = 10, family = NA, plotly = FALSE, - width = NULL, height = NULL){ + txtsz = 3, asreact = FALSE, nrows = 10, family = NA, angle = 90, + size = 10, hjust = 0, plotly = FALSE, width = NULL, height = NULL){ cols <- c('#2DC938', '#E9C318', '#EE7600', '#CC3231', '#800080') @@ -102,7 +105,8 @@ show_fibmatrix <- function(fibdata, yrrng = NULL, ggplot2::theme( axis.title = ggplot2::element_blank(), legend.position = 'none', - panel.grid = ggplot2::element_blank() + panel.grid = ggplot2::element_blank(), + axis.text.x = ggplot2::element_text(angle = angle, hjust = hjust, size = size) ) if(!is.null(txtsz)) diff --git a/man/show_fibmatrix.Rd b/man/show_fibmatrix.Rd index 6b3b6211c..1848d6e3a 100644 --- a/man/show_fibmatrix.Rd +++ b/man/show_fibmatrix.Rd @@ -19,6 +19,9 @@ show_fibmatrix( asreact = FALSE, nrows = 10, family = NA, + angle = 90, + size = 8, + hjust = 0, plotly = FALSE, width = NULL, height = NULL @@ -53,6 +56,12 @@ show_fibmatrix( \item{family}{optional chr string indicating font family for text labels} +\item{angle}{numeric for angle of x-axis text labels} + +\item{size}{numeric for size of the x-axis text labels} + +\item{hjust}{numeric for horizontal justification of x-axis text labels} + \item{plotly}{logical if matrix is created using plotly} \item{width}{numeric for width of the plot in pixels, only applies of \code{plotly = TRUE}}