diff --git a/CITATION.cff b/CITATION.cff index 13bbc10..f04509a 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,6 +1,6 @@ cff-version: 1.2.0 title: vertesy/ggExpress - the fastest way to create, annotate and and save plots in R. -version: v0.9.0 +version: v0.9.5 message: >- If you use this software, please cite it using these metadata. type: software diff --git a/DESCRIPTION b/DESCRIPTION index ae6d9b1..42fce17 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ggExpress Title: ggExpress is the fastest way to create, annotate and export plots in R -Version: 0.9.0 +Version: 0.9.5 Authors@R: person("Abel", "Vertesy", , "av@imba.oeaw.ac.at", role = c("aut", "cre")) Author: Abel Vertesy [aut, cre] @@ -30,9 +30,12 @@ Imports: cowplot, ggVennDiagram, MarkdownReports, + qs, RColorBrewer, - tibble + tibble, + tictoc, + tidyr Encoding: UTF-8 -Packaged: 2023-11-27 00:15:29.839722 +Packaged: 2024-10-24 15:50:59.849277 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 diff --git a/Development/Dependencies.R b/Development/Dependencies.R index 72c711f..5fa9ada 100644 --- a/Development/Dependencies.R +++ b/Development/Dependencies.R @@ -1,51 +1,120 @@ -Dependency file generated on Mon Nov 27 00:06:14 2023 +Dependency file generated on Thu Oct 24 15:20:01 2024 #################################################################################################### ggExpress.R #################################################################################################### -$`character(0)` -[1] "as_tibble" "ggVennDiagram" "iround" "is.list2" "plot_grid" "save_plot" +$`c("package:Connectome.tools", "package:MarkdownHelpers")` +[1] "unless.specified" + +$`c("package:Connectome.tools", "package:Seurat.utils", "package:ggExpress", "package:CodeAndRoll2", "package:dplyr", "package:tidyr", "package:tibble")` +[1] "as_tibble" + +$`c("package:dplyr", "package:ggplot2")` +[1] "sym" + +$`c("package:MarkdownHelpers", "package:CodeAndRoll2")` +[1] "iround" + +$`c("package:MarkdownReports", "package:CodeAndRoll2", "package:stats")` +[1] "median" + +$`c("package:ReadWriter", "package:Stringendo")` +[1] "sppp" + +$`c("package:Seurat.utils", "package:ggExpress", "package:cowplot")` +[1] "plot_grid" "save_plot" + +$`c("package:Seurat.utils", "package:ggExpress", "package:MarkdownHelpers")` +[1] "llogit" + +$`c("package:Seurat.utils", "package:ggExpress")` +[1] "qqSave" "qsave" + +$`c("package:Seurat.utils", "package:ggplot2")` +[1] "coord_polar" "element_text" "geom_hline" "geom_vline" "labs" +[6] "scale_x_log10" "scale_y_log10" "theme" + +$`c("package:Seurat.utils", "package:MarkdownHelpers", "package:Stringendo")` +[1] "percentage_formatter" + +$`c("package:Seurat.utils", "package:MarkdownReports", "package:MarkdownHelpers", "package:Stringendo")` +[1] "iprint" + +$`c("package:Seurat.utils", "package:Stringendo")` +[1] "kpp" + +$`c("package:UVI.tools", "package:ggpubr")` +[1] "ggbarplot" + +$`c("package:UVI.tools", "package:Seurat.utils", "package:ggExpress", "package:tictoc")` +[1] "tic" "toc" + +$`c("package:UVI.tools", "package:Seurat.utils", "package:tibble")` +[1] "rownames_to_column" + +$`c("package:UVI.tools", "package:tidyr")` +[1] "pivot_longer" $`package:base` - [1] "as.character" "as.data.frame" "as.numeric" "c" "cat" "cbind" "colnames" - [8] "factor" "getwd" "is.matrix" "is.null" "is.numeric" "isFALSE" "length" -[15] "make.unique" "max" "names" "ncol" "paste" "paste0" "print" -[22] "rep" "rev" "round" "signif" "sort" "stopifnot" "substitute" -[29] "sum" "unique" "unlist" "which" + [1] "as.character" "as.data.frame" "as.factor" "as.numeric" "c" + [6] "cat" "cbind" "colnames" "factor" "getwd" +[11] "is.character" "is.data.frame" "is.logical" "is.matrix" "is.null" +[16] "is.numeric" "isFALSE" "length" "make.names" "make.unique" +[21] "max" "message" "names" "ncol" "nrow" +[26] "paste" "paste0" "print" "rep" "rev" +[31] "round" "sapply" "signif" "sort" "stop" +[36] "stopifnot" "substitute" "sum" "unique" "unlist" +[41] "which" + +$`package:CodeAndRoll2` +[1] "is.list2" $`package:ggExpress` -[1] "qMarkdownImageLink" "qqqAxisLength" "qqqList.2.DF.ggplot" "qqqNamed.Vec.2.Tbl" "qqSave" +[1] ".assertMaxCategories" "ggVennDiagram" "qMarkdownImageLink" "qqqAxisLength" +[5] "qqqList.2.DF.ggplot" "qqqNamed.Vec.2.Tbl" $`package:ggplot2` - [1] "annotation_logticks" "coord_polar" "element_rect" "element_text" "geom_abline" - [6] "geom_density_2d" "geom_hline" "geom_vline" "guides" "labs" -[11] "scale_fill_gradient" "scale_x_log10" "scale_y_log10" "theme" + [1] "annotation_logticks" "element_rect" "expansion" "geom_abline" + [5] "geom_density_2d" "guide_legend" "guides" "position_fill" + [9] "position_stack" "scale_fill_gradient" "scale_x_continuous" "ylab" $`package:ggpubr` - [1] "ggbarplot" "ggboxplot" "ggdensity" "gghistogram" "ggpar" - [6] "ggpie" "ggscatter" "ggstripchart" "ggviolin" "grids" -[11] "stat_compare_means" "stat_cor" + [1] "ggboxplot" "ggdensity" "gghistogram" "ggpar" + [5] "ggpie" "ggscatter" "ggstripchart" "ggviolin" + [9] "grids" "stat_compare_means" "stat_cor" $`package:MarkdownHelpers` -[1] "llogit" "stopif" "unless.specified" "ww.FnP_parser" -[5] "ww.set.file.extension" "ww.ttl_field" - -$`package:stats` -[1] "median" +[1] "ww.FnP_parser" "ww.set.file.extension" "ww.ttl_field" $`package:Stringendo` -[1] "FixPlotName" "flag.nameiftrue" "iprint" "percentage_formatter" -[5] "sppp" +[1] "FixPlotName" "flag.nameiftrue" "parseParamStringWNames" +[4] "stopif" $`package:utils` -[1] "stack" +[1] "head" "stack" -character(0) +c("Connectome.tools", "MarkdownHelpers") +c("Connectome.tools", "Seurat.utils", "ggExpress", "CodeAndRoll2", "dplyr", "tidyr", "tibble") +c("dplyr", "ggplot2") +c("MarkdownHelpers", "CodeAndRoll2") +c("MarkdownReports", "CodeAndRoll2", "stats") +c("ReadWriter", "Stringendo") +c("Seurat.utils", "ggExpress", "cowplot") +c("Seurat.utils", "ggExpress", "MarkdownHelpers") +c("Seurat.utils", "ggExpress") +c("Seurat.utils", "ggplot2") +c("Seurat.utils", "MarkdownHelpers", "Stringendo") +c("Seurat.utils", "MarkdownReports", "MarkdownHelpers", "Stringendo") +c("Seurat.utils", "Stringendo") +c("UVI.tools", "ggpubr") +c("UVI.tools", "Seurat.utils", "ggExpress", "tictoc") +c("UVI.tools", "Seurat.utils", "tibble") +c("UVI.tools", "tidyr") base +CodeAndRoll2 ggExpress ggplot2 ggpubr MarkdownHelpers -stats Stringendo utils diff --git a/Development/config.R b/Development/config.R index 0c8dda7..49372bb 100644 --- a/Development/config.R +++ b/Development/config.R @@ -1,7 +1,9 @@ # Configuration for the Package +# file.edit("~/GitHub/Packages/ggExpress/Development/config.R") + DESCRIPTION <- list( package.name = "ggExpress", - version = "0.9.0", + version = "0.9.5", title = "ggExpress is the fastest way to create, annotate and export plots in R", description = "ggExpress is a set of R functions that allows you to generate precise figures easily, and create clean markdown reports about what you just discovered with your analysis script. It is ggplot-based smaller brother of vertesy/MarkdownReports. It helps you to: @@ -12,7 +14,7 @@ DESCRIPTION <- list( 5. Share your report, by exporting your report to .pdf, .html or .docx, or via Github or a personal website.", depends = "Stringendo, MarkdownHelpers, ggplot2, ggpubr", - imports = "cowplot, tibble, RColorBrewer, MarkdownReports, CodeAndRoll2, ggVennDiagram", + imports = "cowplot, tibble, tidyr, RColorBrewer, MarkdownReports, CodeAndRoll2, ggVennDiagram, qs, tictoc", author.given = "Abel", author.family = "Vertesy", diff --git a/NAMESPACE b/NAMESPACE index 4df1369..690c974 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -17,6 +17,7 @@ export(qscatter) export(qstripchart) export(qvenn) export(qviolin) +importFrom(CodeAndRoll2,is.list2) importFrom(MarkdownHelpers,llogit) importFrom(cowplot,plot_grid) importFrom(cowplot,save_plot) diff --git a/R/ggExpress.R b/R/ggExpress.R index 6825d34..d16cb47 100644 --- a/R/ggExpress.R +++ b/R/ggExpress.R @@ -131,7 +131,6 @@ qhistogram <- function( #' @param ext File extension (.pdf / .png). #' @param also.pdf Save plot in both png and pdf formats. #' @param save.obj Save the ggplot object to a file. Default: FALSE. -#' @param xlab X-axis label. #' @param plot Display the plot. #' @param plotname The title of the plot and the name of the file (unless specified in `filename`). #' @param subtitle Optional subtitle text added below the title. Default is NULL. @@ -141,6 +140,7 @@ qhistogram <- function( #' @param save Save the plot into a file. #' @param mdlink Insert a .pdf and a .png image link in the markdown report, set by "path_of_report". #' @param logX Make X axis log10-scale. +#' @param xlab X-axis label. Default: FALSE. #' @param xlab.angle Rotate X-axis labels by N degree. Default: 90 #' @param palette_use GGpubr Color palette to use. #' @param hide.legend hide legend @@ -160,6 +160,7 @@ qdensity <- function( also.pdf = FALSE, save.obj = FALSE, ext = MarkdownHelpers::ww.set.file.extension(default = "png", also_pdf = also.pdf), xlab = FALSE, plot = TRUE, + xlab.angle = 90, plotname = FixPlotName(substitute(vec)), subtitle = NULL, suffix = NULL, @@ -168,10 +169,9 @@ qdensity <- function( save = TRUE, mdlink = MarkdownHelpers::unless.specified("b.mdlink", def = FALSE), logX = FALSE, logY = FALSE, palette_use = c("RdBu", "Dark2", "Set2", "jco", "npg", "aaas", "lancet", "ucscgb", "uchicago")[4], - xlab.angle = 90, hide.legend = TRUE, max.names = 50, - grid = F, + grid = FALSE, w = 5, h = w, ...) { if (isFALSE(xlab)) xlab <- plotname df <- qqqNamed.Vec.2.Tbl(namedVec = vec, thr = max.names) @@ -233,7 +233,7 @@ qdensity <- function( #' @param custom.order custom.order #' @param palette_use GGpubr Color palette to use. #' @param max.names The maximum number of names still to be shown on the axis. -#' @param label Slice labels. Set to NULL to remove slice names. +#' @param labels Slice labels. Set to NULL to remove slice names. #' @param w Width of the plot. #' @param h Height of the plot. #' @param ... Pass any other parameter of the corresponding plotting function(most of them should work). @@ -318,7 +318,7 @@ qpie <- function( print(nrCategories.DFcol1) if (NamedSlices) labs <- paste(df$names, "\n", labs) - if (custom.order != F) df$"names" <- factor(df$"names", levels = custom.order) + if (custom.order != FALSE) df$"names" <- factor(df$"names", levels = custom.order) p <- ggpubr::ggpie( data = df, @@ -331,9 +331,9 @@ qpie <- function( title = plotname, palette = palette_use # , ... - ) + + ) + guides(fill = guide_legend(LegendTitle)) - # theme(legend.title = LegendTitle) + # theme(legend.title = LegendTitle) if (LegendSide) p <- ggpubr::ggpar(p, legend = "right") if (custom.margin) p <- p + coord_polar(theta = "y", clip = "off") @@ -375,8 +375,8 @@ qpie <- function( #' @param palette_use GGpubr Color palette to use. #' @param col Color of the plot. #' @param xlab.angle Rotate X-axis labels by N degree. Default: 90 -#' @param xlab X-axis label. -#' @param ylab Y-axis label. +#' @param xlab X-axis label. Default: "". +#' @param ylab Y-axis label. Default: NULL. #' @param logY Make Y axis log10-scale. #' @param label label #' @param hide.legend Hide legend. Default: TRUE. @@ -422,10 +422,9 @@ qbarplot <- function( ylab = NULL, w = qqqAxisLength(vec, factor = 0.25), h = 5, ...) { - stopifnot(is.numeric(vec)) if (isFALSE(xlab)) xlab <- plotname - df <- qqqNamed.Vec.2.Tbl(namedVec = vec, strip.too.many.names = F) + df <- qqqNamed.Vec.2.Tbl(namedVec = vec, strip.too.many.names = FALSE) if (length(unique(df$"names")) == 1) df$"names" <- as.character(1:length(vec)) @@ -460,7 +459,7 @@ qbarplot <- function( if (length(vec) > max.names) p <- p + ggplot2::guides(x = "none") if (hide.legend) p <- p + ggplot2::theme(legend.position = "none") - if(!is.null(legend.title)) p <- p + guides(fill = guide_legend(title = legend.title), color = "none") # Hide the color legend + if (!is.null(legend.title)) p <- p + guides(fill = guide_legend(title = legend.title), color = "none") # Hide the color legend if (hline) p <- p + ggplot2::geom_hline(yintercept = hline) if (logY) p <- p + ggplot2::scale_y_log10() @@ -475,7 +474,8 @@ qbarplot <- function( if (save) { qqSave( ggobj = p, title = plotname, fname = file_name, ext = ext, - w = w, h = h, limitsize = limitsize, also.pdf = also.pdf, save.obj = save.obj) + w = w, h = h, limitsize = limitsize, also.pdf = also.pdf, save.obj = save.obj + ) } if (mdlink & save) qMarkdownImageLink(file_name) if (plot) p @@ -487,10 +487,11 @@ qbarplot <- function( #' #' @description Draw and save a stacked barplot for each row of a dataframe. #' @param df The variable to plot. -#' @param x Colname to split along X axis. Def colnames(df)[1] -#' @param y Colname to count along y axis. Def colnames(df)[3] -#' @param fill Color (split) by along Y. +#' @param x Colname to split along X axis. Default: "Samples". +#' @param y Colname to count along y axis. Default: "Fraction". +#' @param z Colname to split along Y axis. Default: "Category. #' @param color Color (split) by along Y. +# #' @param fill Color (split) by along Y. #' @param ext File extension (.pdf / .png). #' @param also.pdf Save plot in both png and pdf formats. #' @param save.obj Save the ggplot object to a file. Default: FALSE. @@ -499,6 +500,7 @@ qbarplot <- function( #' @param suffix Optional suffix added to the filename. Default is NULL. #' @param caption Optional text added to bottom right corner of the plot. Default = suffix #' @param filename Manually provided filename (optional). Default: parse from `plotname`, +#' @param scale Scale the y axis. Default: TRUE. #' @param plot Display the plot. #' @param save Save the plot into a file. #' @param mdlink Insert a .pdf and a .png image link in the markdown report, set by "path_of_report". @@ -506,7 +508,7 @@ qbarplot <- function( #' @param filtercol Color bars below / above the threshold with red / green. Define the direction by -1 or 1. Takes effect if "*line" is defined. #' @param palette_use GGpubr Color palette to use. #' @param xlab.angle Rotate X-axis labels by N degree. Default: 90 -#' @param xlab X-axis label. +#' @param xlab X-axis label. Default: `x`. #' @param logY Make Y axis log10-scale. #' @param label label #' @param hide.legend hide legend @@ -515,6 +517,7 @@ qbarplot <- function( #' @param annotation_logticks_Y Logical indicating whether to add annotation logticks on Y-axis. Default follows the value of `logY`. #' @param grid Character indicating the axis to add gridlines. Options are 'x', 'y', or 'xy'. Default is 'y'. #' @param max.categ The maximum allowed number of unique categories. +# #' @param top The number of top categories to keep. Default: NULL. #' @param w Width of the plot. #' @param h Height of the plot. #' @param ... Pass any other parameter of the corresponding plotting function(most of them should work). @@ -560,13 +563,14 @@ qbarplot.stacked.from.wide.df <- function( limitsize = FALSE, grid = "y", max.categ = 10, - top = NULL, + # top = NULL, w = qqqAxisLength(df, factor = .7), h = 5, ...) { - message(plotname) - stopifnot(is.data.frame(df), - ncol(df) > 2) + stopifnot( + is.data.frame(df), + ncol(df) > 2 + ) # if (is.null(xlab)) xlab <- if (scale) paste("%", x ) else x if (is.null(subtitle)) subtitle <- paste("Median:", iround(median(df[[2]]))) @@ -576,22 +580,23 @@ qbarplot.stacked.from.wide.df <- function( # } df_long <- df |> - tibble::rownames_to_column(var = x) |> # Convert row names to a column - tidyr::pivot_longer(cols = -!!sym(x), # Convert wide to long format - names_to = z, #"category" - values_to = y # "Fraction" + tibble::rownames_to_column(var = x) |> # Convert row names to a column + tidyr::pivot_longer( + cols = -!!sym(x), # Convert wide to long format + names_to = z, # "category" + values_to = y # "Fraction" ) p <- ggpubr::ggbarplot( data = df_long, x = x, y = y, color = color, - fill = z, # Use the 'category' column created in long format + fill = z, # Use the 'category' column created in long format subtitle = subtitle, title = plotname, xlab = xlab, caption = caption, label = label, palette = palette_use, - position = if(scale) position_fill() else position_stack(), + position = if (scale) position_fill() else position_stack(), ... ) + ggpubr::grids(axis = "y") + @@ -626,9 +631,9 @@ qbarplot.stacked.from.wide.df <- function( #' #' @description Draw and save a barplot for tibbles or dataframes #' @param df The variable to plot. -#' @param x Colname to split along X axis. Def colnames(df)[1] -#' @param y Colname to count along y axis. Def colnames(df)[3] -#' @param fill Color (split) by along Y. +#' @param x Colname to split along X axis. Default: `colnames(df)[1]`. +#' @param y Colname to count along y axis. Default: `colnames(df)[2]`. +#' @param fill Color (split) by along Y. Default: `colnames(df)[3]`. #' @param color Color (split) by along Y. #' @param ext File extension (.pdf / .png). #' @param also.pdf Save plot in both png and pdf formats. @@ -646,7 +651,7 @@ qbarplot.stacked.from.wide.df <- function( #' @param filtercol Color bars below / above the threshold with red / green. Define the direction by -1 or 1. Takes effect if "*line" is defined. #' @param palette_use GGpubr Color palette to use. #' @param xlab.angle Rotate X-axis labels by N degree. Default: 90 -#' @param xlab X-axis label. +#' @param xlab X-axis label. Default: NULL. #' @param logY Make Y axis log10-scale. #' @param annotation_logticks_Y Logical indicating whether to add annotation logticks on Y-axis. Default follows the value of `logY`. #' @param label label @@ -696,13 +701,12 @@ qbarplot.df <- function( max.categ = 10, w = qqqAxisLength(df), h = 5, ...) { - message(plotname) stopifnot(is.data.frame(df), ncol(df) > 2, - "Y axis must be numeric" = is.numeric(y) - ) + "Y axis must be numeric" = is.numeric(y) + ) - if (is.null(xlab)) xlab <- if (scale) paste("%", x ) else x + if (is.null(xlab)) xlab <- if (scale) paste("%", x) else x if (is.null(subtitle)) subtitle <- paste("Median:", iround(median(df[[2]]))) if (is.numeric(df[[fill]])) { @@ -720,7 +724,7 @@ qbarplot.df <- function( caption = caption, label = label, palette = palette_use, - position = if(scale) position_fill() else position_stack(), + position = if (scale) position_fill() else position_stack(), ... ) + ggpubr::grids(axis = "y") + @@ -754,13 +758,17 @@ qbarplot.df <- function( #' @title qscatter #' #' @description Draw and save a 2D-scatter plot. +#' #' @param df_XYcol Data, as 2 column data frame, where col.1 is X axis. +#' @param x The index or name of the column to be plotted on the X axis. Default: `1`. +#' @param y The index or name of the column to be plotted on the Y axis. Default: `2`. #' @param plotname The name of the file and title of the plot. #' @param subtitle Optional subtitle text added below the title. Default is NULL. #' @param suffix Optional suffix added to the filename. Default is NULL. #' @param caption Optional text added to bottom right corner of the plot. Default = suffix #' @param filename Manually provided filename (optional). Default: parse from `plotname`, -#' @param label Point labels +#' @param label Point labels. Default: NULL. +#' @param repel Repel labels from each other. Default: TRUE. #' @param col Color of the plot. #' @param ext File extension (.pdf / .png). #' @param also.pdf Save plot in both png and pdf formats. @@ -769,13 +777,15 @@ qbarplot.df <- function( #' @param logY Make Y axis log10-scale. #' @param hline Draw a horizontal line on the plot, yintercept or FALSE #' @param vline Draw a vertical line on the plot, xintercept or FALSE. -#' @param abline Draw a sloped line on the plot. Set to FALSE, or intercept = abline[1], slope = abline[2]. +#' @param abline Draw a sloped line on the plot. Set to FALSE, or `intercept = abline[1], slope = abline[2]`. #' @param line.col Color of the lines (vline, hline, abline). Default: "darkgrey". #' @param line.width Width of the line (vline, hline, abline). Default: 0.5. #' @param line.type Type of the line (vline, hline, abline). Default: "dashed". #' @param add_contour_plot Add 2D contour plot. See: http://www.sthda.com/english/articles/32-r-graphics-essentials/131-plot-two-continuous-variables-scatter-graph-and-alternatives/#continuous-bivariate-distribution #' @param correlation_r2 Add a correlation value to the plot #' @param plot Display the plot. +#' @param xlab X-axis label. Default: NULL. +#' @param ylab Y-axis label. Default: NULL. #' @param xlab.angle Rotate X-axis labels by N degree. Default: 90 #' @param palette_use GGpubr Color palette to use. #' @param hide.legend hide legend @@ -787,6 +797,7 @@ qbarplot.df <- function( #' @param annotation_logticks_X Logical indicating whether to add annotation logticks on X-axis. Default follows the value of `logX`. #' @param grid Character indicating the axis to add gridlines. Options are 'x', 'y', or 'xy'. Default is 'y'. #' @param ... Pass any other parameter of the corresponding plotting function(most of them should work). +#' #' @examples dfx <- as.data.frame(cbind("AA" = rnorm(500), "BB" = rnorm(500))) #' qscatter(dfx, suffix = "2D.gaussian") #' @@ -823,24 +834,26 @@ qscatter <- function( ...) { # print(plotname) - stopifnot(ncol(df_XYcol) >= 2 - , is.numeric(x) | is.character(x) - , is.numeric(y) | is.character(y) - ) + stopifnot( + ncol(df_XYcol) >= 2, + is.numeric(x) | is.character(x), + is.numeric(y) | is.character(y) + ) if (is.matrix(df_XYcol)) df_XYcol <- as.data.frame(df_XYcol) - if(!is.numeric(x)) { - stopifnot(x %in% colnames(df_XYcol) ) + if (!is.numeric(x)) { + stopifnot(x %in% colnames(df_XYcol)) x <- which(colnames(df_XYcol) == x) } - if(!is.numeric(y)) { - stopifnot(y %in% colnames(df_XYcol) ) + if (!is.numeric(y)) { + stopifnot(y %in% colnames(df_XYcol)) y <- which(colnames(df_XYcol) == y) } - vars <- colnames(df_XYcol); names(vars) <- vars + vars <- colnames(df_XYcol) + names(vars) <- vars cat("Variable (column) names 1-5:", head(vars), "...\n") # browser() @@ -898,13 +911,19 @@ qscatter <- function( #' #' @description Draw and save a boxplot #' @param df_XYcol_or_list Data, as 2 column data frame, where col.1 is X axis, alternatively a uniquely named list ov values. +#' @param x The index or name of the column to be plotted on the X axis. Default: `1`. +#' @param y The index or name of the column to be plotted on the Y axis. Default: `2`. +#' @param col The index or name of the column to be used for coloring the plot. Default: `NULL`. +#' @param fill Fill color of the plot. Default: `gold`. #' @param plotname The title of the plot and the name of the file (unless specified in `filename`). #' @param subtitle Optional subtitle text added below the title. Default is NULL. +#' @param suffix Optional suffix added to the plotname. Default is NULL. #' @param caption Optional text added to bottom right corner of the plot. Default = suffix #' @param filename Manually provided filename (optional). Default: parse from `plotname`, #' @param ext File extension (.pdf / .png). #' @param also.pdf Save plot in both png and pdf formats. #' @param save.obj Save the ggplot object to a file. Default: FALSE. +#' @param ylab Y-axis label. Default: `NULL`. #' @param logY Make Y axis log10-scale. #' @param hline Draw a horizontal line on the plot. #' @param vline Draw a vertical line on the plot. @@ -922,6 +941,7 @@ qscatter <- function( #' @param annotation_logticks_Y Logical indicating whether to add annotation logticks on Y-axis. Default follows the value of `logY`. #' @param grid Character indicating the axis to add gridlines. Options are 'x', 'y', or 'xy'. Default is 'y'. #' @param max.categ The maximum allowed number of unique categories. +#' @param add Add additional graphical elements to the plot. Default: NULL. #' @param w Width of the plot. #' @param h Height of the plot. #' @param ... Pass any other parameter of the corresponding plotting function(most of them should work). @@ -945,7 +965,6 @@ qboxplot <- function( stat.test = TRUE, # , stat.method = "wilcox.test", stat.label.y.npc = 0, stat.label.x = .5 stat.method = NULL, stat.label.y.npc = "top", stat.label.x = NULL, - palette_use = c("RdBu", "Dark2", "Set2", "jco", "npg", "aaas", "lancet", "ucscgb", "uchicago")[4], hide.legend = FALSE, also.pdf = TRUE, save.obj = FALSE, @@ -988,36 +1007,39 @@ qboxplot <- function( if (CodeAndRoll2::is.list2(df_XYcol_or_list)) { lsX <- df_XYcol_or_list df_XYcol <- qqqList.2.DF.ggplot(lsX) - if (length(fill) == length(lsX)) { + if (length(fill) == length(lsX)) { fill <- rep(fill, sapply(lsX, length)) } } else { df_XYcol <- df_XYcol_or_list stopifnot(fill %in% colnames(df_XYcol) | length(fill) == nrow(df_XYcol) | - is.character(fill) | is.null(fill)) + is.character(fill) | is.null(fill)) } .assertMaxCategories(df_XYcol, col = x, max.categ) - vars <- colnames(df_XYcol); names(vars) <- vars + vars <- colnames(df_XYcol) + names(vars) <- vars palette_use_bac <- palette_use - if(length(fill) > 1) { + if (length(fill) > 1) { stopifnot(length(fill) == nrow(df_XYcol) | length(fill) == 1) - if( length(fill) != nrow(df_XYcol)) stop("Length of fill must be 1 or equal to the number of rows in the data frame.") - } else if(length(fill) == 1) { + if (length(fill) != nrow(df_XYcol)) stop("Length of fill must be 1 or equal to the number of rows in the data frame.") + } else if (length(fill) == 1) { fill <- rep(fill, nrow(df_XYcol)) palette_use <- fill - } else message("fill is NULL. Using default fill color.") + } else { + message("fill is NULL. Using default fill color.") + } - df_XYcol$'condition' <- fill - fill = "condition" + df_XYcol$"condition" <- fill + fill <- "condition" - if( !is.null(col)) { + if (!is.null(col)) { # browser() - if( is.numeric(col) & col < length(vars) ) col <- col - if( col %in% vars ) col <- vars[col] + if (is.numeric(col) & col < length(vars)) col <- col + if (col %in% vars) col <- vars[col] fill <- col # if col (color as a column name) is provided, fill is set to col palette_use <- palette_use_bac } @@ -1035,7 +1057,7 @@ qboxplot <- function( add = add, ... ) + - ggplot2::labs(y = ylab) + + ggplot2::labs(y = ylab) + ggpubr::grids(axis = "y") + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = xlab.angle, hjust = 1)) @@ -1065,6 +1087,10 @@ qboxplot <- function( #' #' @description Draw and save a violin plot #' @param df_XYcol_or_list Data, as 2 column data frame, where col.1 is X axis, alternatively a uniquely named list ov values. +#' @param x The index or name of the column to be plotted on the X axis. Default: `1`. +#' @param y The index or name of the column to be plotted on the Y axis. Default: `2`. +#' @param col The index or name of the column to be used for coloring the plot. Default: `NULL`. +#' @param fill Fill color of the plot. Default: `gold`. #' @param plotname Name of the plot #' @param subtitle Optional subtitle text added below the title. Default is NULL. #' @param suffix Optional suffix added to the filename. Default is NULL. @@ -1125,16 +1151,16 @@ qviolin <- function( max.categ = 100, w = qqqAxisLength(df_XYcol_or_list), h = 6, ...) { - df_XYcol <- if (CodeAndRoll2::is.list2(df_XYcol_or_list)) qqqList.2.DF.ggplot(df_XYcol_or_list) else df_XYcol_or_list message("nrow(df_XYcol): ", nrow(df_XYcol)) .assertMaxCategories(df_XYcol, col = x, max.categ) # Define fill color - vars <- colnames(df_XYcol); names(vars) <- vars - if( !is.null(col)) { - if( is.numeric(col) & col < length(vars) ) col <- col - if( col %in% vars ) col <- vars[col] + vars <- colnames(df_XYcol) + names(vars) <- vars + if (!is.null(col)) { + if (is.numeric(col) & col < length(vars)) col <- col + if (col %in% vars) col <- vars[col] fill <- col # if col (color as a column name) is provided, fill is set to col } @@ -1177,11 +1203,16 @@ qviolin <- function( #' #' @description Generates a stripchart and saves the plot for a given 2-column dataframe and offers several customizations. #' @param df_XYcol_or_list Data, as 2 column data frame, where col.1 is X axis, alternatively a uniquely named list ov values. +#' @param x The index or name of the column to be plotted on the X axis. Default: `1`. +#' @param y The index or name of the column to be plotted on the Y axis. Default: `2`. +#' @param col The index or name of the column to be used for coloring the plot. Default: `NULL`. +#' @param fill Fill color of the plot. Default: `gold`. #' @param plotname Name of the plot #' @param subtitle Optional subtitle text added below the title. Default is NULL. #' @param suffix Optional suffix added to the filename. Default is NULL. #' @param caption Optional text added to bottom right corner of the plot. Default = suffix #' @param filename Manually provided filename (optional). Default: parse from `plotname`, +#' @param ylab Y-axis label. Default: NULL.z #' @param plot Display the plot. #' @param add Add boxplot or violin chart? Default add = c("violin", "mean_sd"), it can be "boxplot" or only "mean_sd". #' @param ext File extension (.pdf / .png). @@ -1241,27 +1272,26 @@ qstripchart <- function( max.categ = 100, w = qqqAxisLength(df_XYcol_or_list), h = 6, ...) { - message("Column 1 should be the X-, Column 2 the Y-axis.") stopifnot( CodeAndRoll2::is.list2(df_XYcol_or_list) | is.data.frame(df_XYcol_or_list) # , length(df_XYcol_or_list) > 2 - , length(x) == 1, length(y) == 1 - , is.numeric(x) | is.character(x) - , is.numeric(y) | is.character(y) - , is.null(col) | is.numeric(col) | is.character(col) - , is.null(fill) | is.numeric(fill) | is.character(fill) - + , length(x) == 1, length(y) == 1, + is.numeric(x) | is.character(x), + is.numeric(y) | is.character(y), + is.null(col) | is.numeric(col) | is.character(col), + is.null(fill) | is.numeric(fill) | is.character(fill) ) df_XYcol <- if (CodeAndRoll2::is.list2(df_XYcol_or_list)) qqqList.2.DF.ggplot(df_XYcol_or_list) else df_XYcol_or_list .assertMaxCategories(df_XYcol, col = x, max.categ) # Define fill color - vars <- colnames(df_XYcol); names(vars) <- vars - if( !is.null(col)) { - if( is.numeric(col) & col < length(vars) ) col <- col - if( col %in% vars ) col <- vars[col] + vars <- colnames(df_XYcol) + names(vars) <- vars + if (!is.null(col)) { + if (is.numeric(col) & col < length(vars)) col <- col + if (col %in% vars) col <- vars[col] fill <- col # if col (color as a column name) is provided, fill is set to col } # browser() @@ -1354,7 +1384,7 @@ qvenn <- function( w = 8, h = 0.75 * w, ...) { # - if(!is.null(caption2)) caption <- paste0(caption2, "\n", caption, "\n") + if (!is.null(caption2)) caption <- paste0(caption2, "\n", caption, "\n") p <- ggVennDiagram::ggVennDiagram(list, ..., ) + scale_fill_gradient(low = col.min, high = col.max) + @@ -1377,8 +1407,12 @@ qvenn <- function( sppp(plotname, suffix, s2, "venn", ext) } - if (save) qqSave(ggobj = p, title = plotname, fname = file_name, - ext = ext, w = w, h = h, also.pdf = also.pdf, save.obj = save.obj) + if (save) { + qqSave( + ggobj = p, title = plotname, fname = file_name, + ext = ext, w = w, h = h, also.pdf = also.pdf, save.obj = save.obj + ) + } if (mdlink & save) qMarkdownImageLink(file_name) if (plot) p } @@ -1455,8 +1489,8 @@ qvenn <- function( # color = colorRampPalette(c( "#0073c2","white","#efc000"))(100), # legendName = "Intensity", # scale = "row", -# cluster_rows = F, -# cluster_cols = F, +# cluster_rows = FALSE, +# cluster_cols = FALSE, # annotation_rows = NULL, # annotation_cols = NULL, # annotation_color = NULL, @@ -1583,7 +1617,8 @@ qqSave <- function( h <- wA4 / 2 } } - fnp <- paste0(getwd(), "/", fname); print(fnp) + fnp <- paste0(getwd(), "/", fname) + print(fnp) # Set the plot background to white ggobj <- ggobj + theme(plot.background = element_rect(fill = bgcol, color = bgcol)) @@ -1593,15 +1628,17 @@ qqSave <- function( cowplot::save_plot( plot = ggobj, filename = fname2, base_width = w, base_height = h, title = ww.ttl_field(title, creator = "ggExpress"), - ... ) + ... + ) } cowplot::save_plot( plot = ggobj, filename = fname, - base_width = w, base_height = h, ...) + base_width = w, base_height = h, ... + ) - if(save.obj) { - fnp.qs <- sppp(fnp, 'qs') + if (save.obj) { + fnp.qs <- sppp(fnp, "qs") qs::qsave(ggobj, file = fnp.qs) CMND <- paste0("ggplot_obj <- xread('", fnp.qs, "')") message(CMND) @@ -1634,7 +1671,7 @@ q32vA4_grid_plot <- function( plot_list, suffix = NULL, plotname = FixPlotName(substitute(plot_list), suffix), - plot = F, + plot = FALSE, nrow = 3, ncol = 2, extension = c("pdf", "png")[2], scale = 1, h = hA4 * scale, w = wA4 * scale, @@ -1724,6 +1761,7 @@ qMarkdownImageLink <- function(file_name = "myplot.pdf") { #' @description Define Axis Length #' @param vec The variable to plot. #' @param minLength minLength +#' @param factor Length adjustment factor. #' #' @examples qqqAxisLength() qqqAxisLength <- function(vec = 1:20, minLength = 6, factor = 0.4) { diff --git a/man/q32vA4_grid_plot.Rd b/man/q32vA4_grid_plot.Rd index ecced4d..cfed473 100644 --- a/man/q32vA4_grid_plot.Rd +++ b/man/q32vA4_grid_plot.Rd @@ -8,7 +8,7 @@ q32vA4_grid_plot( plot_list, suffix = NULL, plotname = FixPlotName(substitute(plot_list), suffix), - plot = F, + plot = FALSE, nrow = 3, ncol = 2, extension = c("pdf", "png")[2], diff --git a/man/qbarplot.Rd b/man/qbarplot.Rd index 743d62b..93fd58b 100644 --- a/man/qbarplot.Rd +++ b/man/qbarplot.Rd @@ -72,7 +72,7 @@ qbarplot( \item{col}{Color of the plot.} -\item{xlab}{X-axis label.} +\item{xlab}{X-axis label. Default: "".} \item{xlab.angle}{Rotate X-axis labels by N degree. Default: 90} @@ -94,6 +94,8 @@ qbarplot( \item{grid}{Character indicating the axis to add gridlines. Options are 'x', 'y', or 'xy'. Default is 'y'.} +\item{ylab}{Y-axis label. Default: NULL.} + \item{w}{Width of the plot.} \item{h}{Height of the plot.} diff --git a/man/qbarplot.df.Rd b/man/qbarplot.df.Rd index 2c663ae..3b9a0a2 100644 --- a/man/qbarplot.df.Rd +++ b/man/qbarplot.df.Rd @@ -36,7 +36,6 @@ qbarplot.df( limitsize = FALSE, grid = "y", max.categ = 10, - top = NULL, w = qqqAxisLength(df), h = 5, ... @@ -45,11 +44,11 @@ qbarplot.df( \arguments{ \item{df}{The variable to plot.} -\item{x}{Colname to split along X axis. Def colnames(df)\link{1}} +\item{x}{Colname to split along X axis. Default: \code{colnames(df)[1]}.} -\item{y}{Colname to count along y axis. Def colnames(df)\link{3}} +\item{y}{Colname to count along y axis. Default: \code{colnames(df)[2]}.} -\item{fill}{Color (split) by along Y.} +\item{fill}{Color (split) by along Y. Default: \code{colnames(df)[3]}.} \item{color}{Color (split) by along Y.} @@ -71,6 +70,8 @@ qbarplot.df( \item{filename}{Manually provided filename (optional). Default: parse from \code{plotname},} +\item{scale}{Scale the Y axis to 100\%.} + \item{plot}{Display the plot.} \item{save}{Save the plot into a file.} @@ -85,7 +86,7 @@ qbarplot.df( \item{xlab.angle}{Rotate X-axis labels by N degree. Default: 90} -\item{xlab}{X-axis label.} +\item{xlab}{X-axis label. Default: NULL.} \item{logY}{Make Y axis log10-scale.} @@ -99,6 +100,8 @@ qbarplot.df( \item{grid}{Character indicating the axis to add gridlines. Options are 'x', 'y', or 'xy'. Default is 'y'.} +\item{max.categ}{Maximum number of categories to show on the plot. Default is 10.} + \item{w}{Width of the plot.} \item{h}{Height of the plot.} diff --git a/man/qbarplot.stacked.from.wide.df.Rd b/man/qbarplot.stacked.from.wide.df.Rd index ff8d347..acea4cd 100644 --- a/man/qbarplot.stacked.from.wide.df.Rd +++ b/man/qbarplot.stacked.from.wide.df.Rd @@ -36,7 +36,6 @@ qbarplot.stacked.from.wide.df( limitsize = FALSE, grid = "y", max.categ = 10, - top = NULL, w = qqqAxisLength(df, factor = 0.7), h = 5, ... @@ -45,9 +44,11 @@ qbarplot.stacked.from.wide.df( \arguments{ \item{df}{The variable to plot.} -\item{x}{Colname to split along X axis. Def colnames(df)\link{1}} +\item{x}{Colname to split along X axis. Default: "Samples".} -\item{y}{Colname to count along y axis. Def colnames(df)\link{3}} +\item{y}{Colname to count along y axis. Default: "Fraction".} + +\item{z}{Colname to split along Y axis. Default: "Category.} \item{color}{Color (split) by along Y.} @@ -69,6 +70,8 @@ qbarplot.stacked.from.wide.df( \item{filename}{Manually provided filename (optional). Default: parse from \code{plotname},} +\item{scale}{Scale the y axis. Default: TRUE.} + \item{plot}{Display the plot.} \item{save}{Save the plot into a file.} @@ -83,7 +86,7 @@ qbarplot.stacked.from.wide.df( \item{xlab.angle}{Rotate X-axis labels by N degree. Default: 90} -\item{xlab}{X-axis label.} +\item{xlab}{X-axis label. Default: \code{x}.} \item{logY}{Make Y axis log10-scale.} @@ -104,8 +107,6 @@ qbarplot.stacked.from.wide.df( \item{h}{Height of the plot.} \item{...}{Pass any other parameter of the corresponding plotting function(most of them should work).} - -\item{fill}{Color (split) by along Y.} } \description{ Draw and save a stacked barplot for each row of a dataframe. diff --git a/man/qboxplot.Rd b/man/qboxplot.Rd index b398fc7..f6af4ef 100644 --- a/man/qboxplot.Rd +++ b/man/qboxplot.Rd @@ -46,10 +46,20 @@ qboxplot( \arguments{ \item{df_XYcol_or_list}{Data, as 2 column data frame, where col.1 is X axis, alternatively a uniquely named list ov values.} +\item{x}{The index or name of the column to be plotted on the X axis. Default: \code{1}.} + +\item{y}{The index or name of the column to be plotted on the Y axis. Default: \code{2}.} + +\item{col}{The index or name of the column to be used for coloring the plot. Default: \code{NULL}.} + +\item{fill}{Fill color of the plot. Default: \code{gold}.} + \item{plotname}{The title of the plot and the name of the file (unless specified in \code{filename}).} \item{subtitle}{Optional subtitle text added below the title. Default is NULL.} +\item{suffix}{Optional suffix added to the plotname. Default is NULL.} + \item{caption}{Optional text added to bottom right corner of the plot. Default = suffix} \item{filename}{Manually provided filename (optional). Default: parse from \code{plotname},} @@ -74,6 +84,8 @@ qboxplot( \item{ext}{File extension (.pdf / .png).} +\item{ylab}{Y-axis label. Default: \code{NULL}.} + \item{logY}{Make Y axis log10-scale.} \item{annotation_logticks_Y}{Logical indicating whether to add annotation logticks on Y-axis. Default follows the value of \code{logY}.} @@ -94,6 +106,8 @@ qboxplot( \item{max.categ}{The maximum allowed number of unique categories.} +\item{add}{Add additional graphical elements to the plot. Default: NULL.} + \item{w}{Width of the plot.} \item{h}{Height of the plot.} diff --git a/man/qdensity.Rd b/man/qdensity.Rd index 36421dc..0a4e153 100644 --- a/man/qdensity.Rd +++ b/man/qdensity.Rd @@ -11,6 +11,7 @@ qdensity( ext = MarkdownHelpers::ww.set.file.extension(default = "png", also_pdf = also.pdf), xlab = FALSE, plot = TRUE, + xlab.angle = 90, plotname = FixPlotName(substitute(vec)), subtitle = NULL, suffix = NULL, @@ -22,10 +23,9 @@ qdensity( logY = FALSE, palette_use = c("RdBu", "Dark2", "Set2", "jco", "npg", "aaas", "lancet", "ucscgb", "uchicago")[4], - xlab.angle = 90, hide.legend = TRUE, max.names = 50, - grid = F, + grid = FALSE, w = 5, h = w, ... @@ -40,10 +40,12 @@ qdensity( \item{ext}{File extension (.pdf / .png).} -\item{xlab}{X-axis label.} +\item{xlab}{X-axis label. Default: FALSE.} \item{plot}{Display the plot.} +\item{xlab.angle}{Rotate X-axis labels by N degree. Default: 90} + \item{plotname}{The title of the plot and the name of the file (unless specified in \code{filename}).} \item{subtitle}{Optional subtitle text added below the title. Default is NULL.} @@ -64,8 +66,6 @@ qdensity( \item{palette_use}{GGpubr Color palette to use.} -\item{xlab.angle}{Rotate X-axis labels by N degree. Default: 90} - \item{hide.legend}{hide legend} \item{max.names}{The maximum number of names still to be shown on the axis.} diff --git a/man/qpie.Rd b/man/qpie.Rd index 43425a5..2dcb451 100644 --- a/man/qpie.Rd +++ b/man/qpie.Rd @@ -88,13 +88,13 @@ qpie( \item{both_pc_and_value}{Report both percentage AND number.} +\item{labels}{Slice labels. Set to NULL to remove slice names.} + \item{w}{Width of the plot.} \item{h}{Height of the plot.} \item{...}{Pass any other parameter of the corresponding plotting function(most of them should work).} - -\item{label}{Slice labels. Set to NULL to remove slice names.} } \description{ Draw and save a pie chart diff --git a/man/qqqAxisLength.Rd b/man/qqqAxisLength.Rd index c2edca0..5b6e0a2 100644 --- a/man/qqqAxisLength.Rd +++ b/man/qqqAxisLength.Rd @@ -10,6 +10,8 @@ qqqAxisLength(vec = 1:20, minLength = 6, factor = 0.4) \item{vec}{The variable to plot.} \item{minLength}{minLength} + +\item{factor}{Length adjustment factor.} } \description{ Define Axis Length diff --git a/man/qscatter.Rd b/man/qscatter.Rd index ae17d39..8bc030d 100644 --- a/man/qscatter.Rd +++ b/man/qscatter.Rd @@ -49,6 +49,10 @@ qscatter( \arguments{ \item{df_XYcol}{Data, as 2 column data frame, where col.1 is X axis.} +\item{x}{The index or name of the column to be plotted on the X axis. Default: \code{1}.} + +\item{y}{The index or name of the column to be plotted on the Y axis. Default: \code{2}.} + \item{plotname}{The name of the file and title of the plot.} \item{subtitle}{Optional subtitle text added below the title. Default is NULL.} @@ -65,7 +69,9 @@ qscatter( \item{col}{Color of the plot.} -\item{label}{Point labels} +\item{label}{Point labels. Default: NULL.} + +\item{repel}{Repel labels from each other. Default: TRUE.} \item{palette_use}{GGpubr Color palette to use.} @@ -81,13 +87,17 @@ qscatter( \item{annotation_logticks_X}{Logical indicating whether to add annotation logticks on X-axis. Default follows the value of \code{logX}.} +\item{xlab}{X-axis label. Default: NULL.} + +\item{ylab}{Y-axis label. Default: NULL.} + \item{xlab.angle}{Rotate X-axis labels by N degree. Default: 90} \item{hline}{Draw a horizontal line on the plot, yintercept or FALSE} \item{vline}{Draw a vertical line on the plot, xintercept or FALSE.} -\item{abline}{Draw a sloped line on the plot. Set to FALSE, or intercept = abline\link{1}, slope = abline\link{2}.} +\item{abline}{Draw a sloped line on the plot. Set to FALSE, or \verb{intercept = abline[1], slope = abline[2]}.} \item{line.col}{Color of the lines (vline, hline, abline). Default: "darkgrey".} diff --git a/man/qstripchart.Rd b/man/qstripchart.Rd index 259dcbc..e415f34 100644 --- a/man/qstripchart.Rd +++ b/man/qstripchart.Rd @@ -46,6 +46,14 @@ qstripchart( \arguments{ \item{df_XYcol_or_list}{Data, as 2 column data frame, where col.1 is X axis, alternatively a uniquely named list ov values.} +\item{x}{The index or name of the column to be plotted on the X axis. Default: \code{1}.} + +\item{y}{The index or name of the column to be plotted on the Y axis. Default: \code{2}.} + +\item{col}{The index or name of the column to be used for coloring the plot. Default: \code{NULL}.} + +\item{fill}{Fill color of the plot. Default: \code{gold}.} + \item{plotname}{Name of the plot} \item{subtitle}{Optional subtitle text added below the title. Default is NULL.} @@ -56,6 +64,8 @@ qstripchart( \item{filename}{Manually provided filename (optional). Default: parse from \code{plotname},} +\item{ylab}{Y-axis label. Default: NULL.z} + \item{plot}{Display the plot.} \item{add}{Add boxplot or violin chart? Default add = c("violin", "mean_sd"), it can be "boxplot" or only "mean_sd".} diff --git a/man/qviolin.Rd b/man/qviolin.Rd index 1bdfc96..451cc48 100644 --- a/man/qviolin.Rd +++ b/man/qviolin.Rd @@ -43,6 +43,14 @@ qviolin( \arguments{ \item{df_XYcol_or_list}{Data, as 2 column data frame, where col.1 is X axis, alternatively a uniquely named list ov values.} +\item{x}{The index or name of the column to be plotted on the X axis. Default: \code{1}.} + +\item{y}{The index or name of the column to be plotted on the Y axis. Default: \code{2}.} + +\item{col}{The index or name of the column to be used for coloring the plot. Default: \code{NULL}.} + +\item{fill}{Fill color of the plot. Default: \code{gold}.} + \item{plotname}{Name of the plot} \item{subtitle}{Optional subtitle text added below the title. Default is NULL.}