Changelog
Source:NEWS.md
statplot (development version)
Added
patchwork_rowtitle: new function to create row titles for patchwork compositions. Produces a ggplot object with centered text in a customizable box, suitable for use as either an entire row spanning all columns or as a narrow left-side column. Supports customization of text position/size (x,y,size,hjust,vjust), background styling (fill,color,linewidth), and plot margins (margin_top,margin_right,margin_bottom,margin_left).quarto_note: new function to render colored reviewer or collaborator notes in Quarto documents. Produces colored text in HTML, colored LaTeX in PDF, and custom paragraph styles in Word documents. Supports customizable text color and Word style names.
Changed
theme_bw2andtheme_classic2: refactored to use an internaltheme_base()helper function that consolidates common bold styling (titles, axis labels, legend titles, and plot tags). Both themes now applytheme_base()consistently, reducing code duplication.plot_pvalue_barplot: newexponentiate_labelsargument (defaultFALSE) allows formatting x-axis labels with exponential notation and superscripts (e.g., 1, 10^-1, 10^-2, 10^-3, <10^-x) whenmlog10_transform_pvalue = TRUE. Uses R expressions viabquote()for proper rendering of mathematical notation in plots. Whenexponentiate_labels = TRUEwithoutmlog10_transform_pvalue = TRUE, a warning is issued.-
plot_barplot_by_group: major refactoring for more flexible faceting support:-
Breaking changes: removed
group_colparameter (no longer auto-facets by group); removedshow_text_groupsparameter; removedstrip_positionparameter -
New parameter:
facet_cols(optional character vector) supports multi-level faceting via user-supplied column names; when supplied, significance brackets are computed per unique combination of those columns -
API changes:
condition_col,mean_col,error_col, andp_colare now required arguments (previously had defaults) -
Faceting approach: users now explicitly add
+ ggplot2::facet_wrap()or+ ggplot2::facet_grid()after the function call; bracket annotations facet automatically via retained grouping columns - Updated examples: demonstrate single-panel, single-faceting, multi-faceting, and custom label workflows
-
Breaking changes: removed
Fixed
-
plot_confidence_intervals: fixed y-axis alignment when displaying grouped data with a p-value barplot. Previously, the y-axis limits of the confidence interval plot were calculated based on the dodgedy_posvalues, causing misalignment with the p-value plot’s fixed limits. Now uses fixed y-axis limits that match the p-value panel, ensuring perfect alignment of tick marks regardless of dodging.
statplot 0.6.0 - 2026-04-15
Added
-
table_basic: new function for creating clean, formatted tables using tinytable. Supports column-level rounding control via named lists or vectors, optional comma formatting for large numbers, and configurable handling of missing values. By default uses bold header rows and can respect columnlabelattributes.
Changed
plot_pvalue_barplot: expanded examples to demonstrate 6 use cases including default p/q-value overlay, basic transformation with vline, raw p-value scale, fill mapping by group, custom significance thresholds, and custom q-values.plot_pvalue_barplot: default-log10(p)x-axis breaks now use meaningful p-value ticks (1, 0.1, 0.01, 0.001) instead of equally-spaced integer breaks; the smallest p-value tick is labeled with a"<"prefix (e.g.,"<0.001") to indicate that values below this threshold are represented, and the label is determined by the largest break on the -log10 scale (not hard-coded to0.001) for robust support of custom breaks.plot_pathways: defaultcolor_low,color_mid, andcolor_highchanged fromNULLto"blue","white", and"red", respectively, providing a sensible default diverging color palette without requiring explicit user specification.plot_pathways,plot_dotmap: newlegend_positionargument (default"right") allows users to control the legend position viaggplot2::theme(legend.position = ...). Common values include"right","left","top","bottom", or"none"to hide the legend.combine_pvalues: now allows p-values equal to 1 (previously rejected); validation changed fromp > 0 & p < 1top > 0 & p <= 1.plot_confidence_intervals: refactor — replace the monolithicstyleparameter with independent arguments for visual encoding and layout:color_col,color_values,shape_col, andpoint_shapes(for shape-based grouping), plus separator and reference-line controls (show_separators,sep_linetype,sep_linewidth,sep_color,vline_xintercept,vline_linetype,vline_color) anddodge_width. This makes styling explicit and composable and simplifies legend handling.plot_confidence_intervals: ensureshape_colis coerced to a factor with a stable, sorted level ordering; validatepoint_shapeslength against the number of shape levels and provide clearer legend overrides whencolor_coland/orshape_colare used.plot_2_categorical_vars: addedinside_bar_text_boldargument to allow inside-bar labels to be drawn in bold when requested; documentation and examples updated to demonstrateyvar_text_colorscombined with the new bold-text option.plot_2_categorical_vars: updated examplesAll roxygen2 examples for plot functions now begin with
ggplot2::theme_set(theme_bw2())to apply the package theme consistently across all example code blocks.
Fixed
plot_pvalue_barplot: fixed legend linetype to remove unwanted line rendering for fill-mapped bars by applyingoverride.aes = list(linetype = 0)to the fill legend so legend keys display as solid/filled swatches.plot_covariate_heatmap: removed whitespace padding between covariate bars and plot borders by applyingexpand = ggplot2::expansion(0)to both applicable scales in vertical and horizontal layouts.
statplot 0.5.0 - 2026-04-10
Added
theme_bw2andtheme_classic2: commonly used themesplot_confidence_intervals: addedpvalue_plot_marginargument to parameterize the p-value panel plot margin (points), defaultc(5.5, 12, 5.5, 0). This prevents x-axis labels on the appended p-value barplot from being clipped when the panel is composed to the right usingpatchwork.hallmark_pathway_categories: new internal dataset mapping Hallmark pathway names (thetermcolumn, with theHALLMARK_prefix removed) to biological process categories as defined in Table 1 of Liberzon et al. (2015). The dataset includes a runtime validation step against the bundledhallmark_t2gdata to ensure pathway names align with MSigDB.plot_covariate_heatmap: new function to draw vertical covariate strips (one strip per covariate). Supports categorical covariates (named color vectors) only.plot_barplot_by_group: new two-condition bar plot function for comparing a numeric outcome across groups. Supportserror_direction = c("both", "up"), configurablebar_width,bar_gap, andbar_padding, optional facet layout viafacet/strip_position, and custom bracket labels vialabel_col.plot_pathways: newpathway_catsandpathway_cat_colorsarguments let users fill pathway nodes by biological process category. The accompanyinglegend_pathway_fill_titleandlegend_pathway_fill_dot_sizearguments customise the category fill legend, while the gene effect-size colour scale remains independent.
Changed
-
plot_dot_whiskershas been renamed toplot_confidence_intervals. The function signature and behavior have been significantly enhanced:-
Parameter renames for clarity:
x→effect_size,xmin→ci_low,xmax→ci_high,label_col→id -
New parameters:
-
effect_size,ci_low,ci_high, andidare now required arguments (previously optional with defaults) -
color_col: optional column for coloring segments and points (can be group-based or id-based) -
color_values: optional named character vector for custom colors -
combine_pvalue_method: method for combining p-values whengroup_colis supplied (default"fisher")
-
-
Enhanced p-value panel logic: When
group_colis specified, p-values are now automatically combined across groups for eachidusing the specified method, eliminating the need for pre-computed combined p-values. Whengroup_colisNULL, individual p-values are displayed directly. - Improved styling: Supports shape-based and color-based group distinction, with flexible color and shape customization options
-
Parameter renames for clarity:
plot_barplot_by_group: changedbracket_offsetdefault from0.08to1.0and updated the parameter documentation to clarify that it is now an absolute distance in data units (formerly a fraction of the y range).plot_dotmap: added a short example demonstratingonly_show_top_sig(shows top N rows in the combined p-value barplot) and updated thecombine_pvalue_methodparameter documentation to referencecombine_pvaluesfor method details.combine_pvalues: defaultmethodschanged from'all'to'CMC'; documentation and tests updated to reflect the new default.plot_dotmap: the defaultcombine_pvalue_methodis now"fisher"(was previously"CMC"when not supplied viamatch.arg()); documentation and examples updated to reflect the new default choice.plot_pvalue_barplot: improved legend behaviour — when a vertical significance line legend is requested (vline = TRUE, vline_legend = TRUE) the colour scale now stores an explicit namedvaluesvector so code and tests can programmatically find the named alpha entry; also the fill legend usesoverride.aesto remove line linetype in legend keys when showing p/q bars so legend keys render as solid/filled swatches.plot_pvalue_barplot: addedvline_legendto optionally include or suppress the vertical significance line legend key.plot_pathways: defaultlegend_pathway_size_titlechanged to"Num. genes\n in pathway"and defaultlegend_color_titlechanged to"Gene effect size".
Fixed
-
plot_dotmap:combine_pvalues()is now called withmethods = combine_pvalue_methodinstead of subsetting the result by name. Previously,combine_pvalues()defaulted to computing only"CMC", so requesting any other method (e.g."fisher") returnedNA, causing the combined p-value barplot to draw no bars.
statplot 0.4.0 - 2026-03-26
Added
-
plot_data_avail_by_group: tile plot showing availability (0/1) of data types across groups, with a black border, no whitespace padding, and optional bold axis labels. -
plot_pathways: newlegend_fixed_dot_sizeargument (numeric vector) fixes the size-legend breaks and limits to user-supplied gene-count values so that multiple plots composed withpatchworkshare an identical visual size scale. Values outside the specified range are squished to the nearest extreme rather than dropped.
Changed
-
plot_pathways: thefold_changeargument has been renamed toeffect_size. Code usingfold_change = ...must be updated. -
plot_pathways: defaulteffect_size_thresholdchanged from1.5to0(show all genes by default). -
plot_pathways: out-of-bounds gene values are now squished (viascales::squish) rather than censored toNAfor all color scale paths (diverging, sequential, and in-placecolorkey_limits), and for the size scale whenlegend_fixed_dot_sizeis set. This prevents genes outsidecolorkey_limitsfrom rendering as grey. -
plot_heatmap: whenanno_colorsis supplied for a categorical covariate, all user-specified color levels now always appear in the annotation legend—including levels absent from the current data (e.g. when plotting a subset). To show only levels present in the data, omit the unwanted levels from theanno_colorsnamed vector. -
plot_heatmap: added a newmerge_legendsargument (defaultFALSE). WhenTRUEthe function:- deduplicates annotation legends whose color mappings are semantically equivalent (named vectors are compared after sorting by name;
circlize::colorRamp2functions are compared by their breakpoints and colours), combining their titles (e.g."pvalue\nqvalue") and suppressing redundant legends; - forwards the flag to
ComplexHeatmap::draw(..., merge_legends = TRUE)so heatmap and annotation legends are packed together. Unit tests covering the deduplication and semantic comparison behaviour were added.
- deduplicates annotation legends whose color mappings are semantically equivalent (named vectors are compared after sorting by name;
Fixed
-
plot_dotmap:custom_qvaluespassed via...now correctly drives the q-value bars in the combined p-value barplot. Previously the argument was stripped before being forwarded toplot_pvalue_barplot(), causing the barplot to always display internally computed BH-adjusted q-values instead of the user-supplied ones. The supplied column is now joined from the input data into the combined-p data frame and forwarded ascustom_qvalues; when not supplied, the BH fallback is used as before.
statplot 0.3.0 - 2026-03-20
Added
-
run_gsea: wrapper aroundclusterProfiler::GSEA()for gene set enrichment analysis on a pre-ranked gene vector; returns results alongside the inputs needed by the pathway plotting functions below. -
plot_pathways: gene–pathway bipartite network (cnetplot) showing the top GSEA pathways and their constituent genes, with nodes colored by fold change. -
plot_pathway_correlation_network: gene–gene Pearson correlation network for a single pathway, with edges filtered by a correlation threshold and nodes colored by fold change and sized by degree (hub genes appear larger). - Example datasets
ex_expr_pathway,ex_log2fc_pathway, andhallmark_t2gbundled to support pathway analysis examples and vignettes. -
plot_numeric_by_3plusgroupsfor creating violin + boxplots of a numeric variable by a grouping factor, with optional effect size and pairwise Wilcoxon test letters. -
plot_numeric_by_2groupsfor creating violin + boxplots of a numeric variable by a grouping factor with exactly 2 levels
Changed
-
plot_pathways: several arguments renamed for clarity:-
fc_threshold→effect_size_threshold -
fc_threshold_label→subtitle_effect_size_label -
show_category→show_pathways -
size_item→gene_node_size -
size_edge→line_size -
category_color/category_size→pathway_color/pathway_label_size -
item_color/item_size→gene_color/gene_label_size
-
-
plot_pathways: newmax_genes_shownargument adaptively raiseseffect_size_thresholdso that at mostmax_genes_showngene nodes are displayed; the chosen cutoff is reported in an auto-generated plot subtitle (subtitle is suppressed whenmax_genes_shownisNULL). -
plot_pathways: newsubtitle_effect_size_labelargument controls the effect-size label shown insideabs()in the subtitle (default"effect size"). -
plot_pathways: newlegend_pathway_size_title(default"Num. genes") andlegend_color_title(default"Effect size") arguments to customise legend titles for node size and color, respectively. -
plot_pathways:legend_color_titlenow accepts plotmath expressions viaexpression(); validation and documentation updated. -
plot_pathways: newcolorkey_breaksandcolorkey_limitsarguments to control the tick-mark values and range shown on the color legend. -
plot_pathways: newcolor_low,color_mid, andcolor_higharguments to customise the color scale. Supplying all three produces a 3-color diverging scale; omittingcolor_midproduces a 2-color sequential scale; leaving all threeNULLpreserves the default cnetplot palette. -
plot_pathways: newplot_marginargument (c(top, right, bottom, left)in lines, defaultc(0.5, 0.5, 0.5, 0.5)) to control whitespace around the plot and prevent node labels from being clipped at the edges. -
plot_2_categorical_vars: newinside_bar_statsargument controls what is printed inside the stacked bars —"pct"(default, within-group percentage),"n"(count only),"pct_and_n"(percentage and count formatted aspct% (n)), or"none"(no labels). -
plot_2_categorical_vars: newinclude_overall_barargument (defaultFALSE); whenTRUE, a pooled bar showing the marginal distribution ofyvaracross all observations is prepended to the left of the per-group bars and separated by a vertical line. The bar respectsinside_bar_statsand displays the total N label above it like all other bars. The bar label defaults to"Overall"and can be customised via the newoverall_labelargument. -
plot_dotmap: newqargument accepts an optional column name of per-cell q-values (e.g. FDR-adjusted p-values) to use for cell shading instead of raw p-values. When bothpandqare supplied the combined p-value barplot (right panel) is still computed fromp, so Fisher/CMC combination uses raw p-values while cells reflect adjusted values. -
plot_pvalue_barplot:NAp-values are now handled gracefully — rows with missing p-values are silently dropped rather than causing an error, and BH correction for q-values is applied only to the non-missing subset so adjusted values are not distorted. - Use
stats::reformulate()with backticks when building formulas in numeric-by-group plotting functions to support non-syntactic column names (fixes issue with spaces/hyphens).
statplot 0.2.0 - 2026-03-06
Added
-
plot_dot_whiskersfor plotting effect sizes and confidence intervals, optionally by group and with pvalue barplot -
plot_heatmap- By default, white gridlines around cells
- Add support for categorical heatmaps
- Support for clustering categorical data
-
quarto_html_tabset_list: convert a named list object to a tabset when knitting to HTML -
format_pvalue: function to format pvalues to display in plots -
combine_pvaluesfunction to combine pvalues to produce a single overall pvalue- Updated methods for contemporary best practices
-
plot_pvalue_barplot: horizontal barplot of pvalues- By default now shows both pvalues and qvalues stacked
-
plot_dotmap: plot heatmap of effect sizes (dots) with cells shaded by pvalue- option to add combined pvalue barplot on the right
- Changed default combo method to CMC as recommended by literature
- option to show q-values for the combined pvalue barplot
- 5 methods are supported when combining pvalues
- show an x symbol if dot is missing
- option to add combined pvalue barplot on the right