ggExpress is an R package designed to generate publication- and presentation-ready figures with minimal effort. Built on top of ggplot2 and ggpubr, it dramatically reduces the amount of code required to produce clean, well-annotated visualizations.
It automatically handles common, repetitive tasks such as plot annotation, sizing, and file export. The guiding principle is simple: understandable, annotated, high-quality figures from minimal code.
A base graphics based alternative is MarkDownreports, which follows the same principles.
Although ggplot2 is the standard for professional visualization in R, achieving polished results typically requires verbose code and extensive manual tuning. Default aesthetics are rarely optimal for talks or publications, and users repeatedly reimplement the same logic for annotation, sizing, and saving outputs. The simplest tasks often take way too much effort in ggplot (e.g.: I have a numeric vector, show how many pass a threshold? (calculate and plot this, annotate, export drop-in ready for a work meeting). This is a one liner in ggExpress.
ggExpress addresses this friction by providing single-function calls that automatically infer annotations from data structures, row- and column-names; It guesses sensible canvas sizes based on the amount of data shown, and apply clean, presentation-ready aesthetics out of the box.
Each call simultaneously (1) displays the plot, (2) saves it as PNG (optionally also PDF), and (3) saves the corresponding ggplot object, without additional code.
This supports a smooth workflow across the usability–customizability spectrum: PNG for immediate use, vector PDFs for post hoc editing, and ggplot objects for further refinement in R. Underlying ggpubr arguments remain accessible via ..., ensuring speed without sacrificing control.
FYI: Base R graphics can produce visually acceptable plots with minimal code, but lacks similar automation, and the flexibility and extensibility required for serious figure production.
If you prefer a base graphics, see: MarkDownreports.
Install directly from GitHub via devtools with one R command:
# install.packages("devtools"); # If you don't have it.
require("devtools")
# Install dependencies
devtools::install_github(repo = "vertesy/Stringendo", ref = "main", upgrade = F)
devtools::install_github(repo = "vertesy/ReadWriter", ref = "main", upgrade = F)
devtools::install_github(repo = "vertesy/CodeAndRoll2", ref = "main", upgrade = F)
devtools::install_github(repo = "vertesy/MarkdownHelpers", ref = "main", upgrade = F)
# Install ggExpress
devtools::install_github(repo = "vertesy/ggExpress", ref = "main", upgrade = F)...then simply load the package:
require("ggExpress")Alternatively, you can simply source it from the web. This way function help will not work, and you will have no local copy of the code on your hard drive.
source("https://raw.githubusercontent.com/vertesy/ggExpress/main/R/ggExpress.functions.R")
source("https://raw.githubusercontent.com/vertesy/ggExpress/main/R/ggExpress.auxiliary.functions.R")If you encounter a bug, something doesn't work or is unclear, please let me know by raising an issue on ggExpress – Please check if it has been asked.
# ggExpress mini-vignette: plot, annotate & export in one line
# -----------------------------------------------------------
# 1) Named vector → barplot & pie chart with auto labels and filenames --------------------
Medals <- c(Bulgaria = 12, Brazil = 29, Burkina = 5)
# The one liner below:
# - Creates and annotates the plot (X axis and title)
# - saves PNG
# - returns the ggplot object for further customization (through `invisible()`).
qbarplot(Medals)
# > /path/to/Medals.bar.png
qpie(Medals)
# > /path/to/Medals.pie.png
# Show values on bars
# Add a suffix string to the filename
# Add a horizontal line at y = 10
qbarplot(Medals, label = T, suffix = "BigGames26", hline = 10, filtercol = T)
# Show both percentage and value on bars
# Add a legend title
qpie(Medals, both_pc_and_value = T, LegendTitle = "Country")
Saved as .png by default.
| Bar plot | Pie chart |
|---|---|
![]() |
![]() |
# 2) Numeric vector → histogram + density, auto labels, auto filenames, ggplot objects ----
patient_weight <- rnorm(1000, mean = 80, sd = 10)
# The one liner below:
# - Takes plot title from the object name 'weight'
# - draws a histogram with median line
# - saves PNG
# - returns the ggplot object for further customization (through `invisible()`).
qhistogram(patient_weight)
# Add show threshold
qhistogram(vec = patient_weight, vline = 93.99, filtercol = T,
subtitle = "passing below limit", caption = "District Hospital X")
# Desity plot. Also save as PDF and the ggplot object:
qdensity(patient_weight, also.pdf = TRUE, save.obj = TRUE)
> ggplot_obj <- xread('~/path/to/patient_weight.dens.png.qs')Output plots
| Histogram | Density plot |
|---|---|
![]() |
![]() |
# 1b) You still have a regular ggplot object, that you can further modify and simply resave:
(weight_hist <- weight_hist + ggplot2::theme_minimal() + ggplot2::labs(subtitle = "Modified with theme_minimal") )
qqSave(weight_hist) # Saves with the auto-generated filename from the variable nameLetterSets <- list("Alpha" = LETTERS[1:7], "Bet" = LETTERS[6:14])
qvenn(LetterSets)
ToothLen.by.Dose <- ToothGrowth[, c("dose", "len")]; head(ToothLen.by.Dose)
qviolin(ToothLen.by.Dose, stat.test = T, col = "dose")| Venn Diagram | Violin plot |
|---|---|
![]() |
# 3) Data frame → scatter plot with automatic x/y labels and export -----------------------
patient_measurements <- data.frame(
height_cm = rnorm(200, mean = 170, sd = 10),
weight_kg = rnorm(200, mean = 70, sd = 12)
)
# Minimal scatter:
# - plot title from 'patient_measurements'
# - x/y labels from 'height_cm' and 'weight_kg'
# - filename guessed from the data frame name
qscatter(patient_measurements)
# You can add contours and correlation annotation, and any other ggpubr stats:
qscatter(
patient_measurements,
add_contour_plot = TRUE,
correlation_r2 = 'pearson'
)
# At this point you have:
# - a set of .png and .pdf files with auto-generated, informative filenames
# - matching ggplot objects (p_hist, p_dens, p_bar, p_pie, p_scatter) that you can further modify or embed in other figures.
# - (optionally) auto-saved ggplot objects as .qs files.| Simple | Customized |
|---|---|
![]() |
![]() |
Updated: 2025/12/02 20:14
Quickly draw and save a histogram (png, pdf, ggobj.qs). This all-in-one function draws, annotates, displays and saves a histogram of a distribution provided as a numeric vector. It is a wrapper around ggpubr::gghistogram(), with the automation of many features. All ggpubr parameters can be accessed through the ... argument. It can automatically save the plot as png (default) and/or pdf files, and the ggplot object as a .qs file.
Quickly draw and save a density plot (png, pdf, ggobj.qs). This all-in-one function draws, annotates, displays and saves a density plot of a distribution provided as a numeric vector. It is a wrapper around ggpubr::ggdensity(), with the automation of many features. All ggpubr parameters can be accessed through the ... argument. It can automatically save the plot as png (default) and/or pdf files, and the ggplot object as a .qs file.
Quickly draw and save a pie chart (png, pdf, ggobj.qs). This all-in-one function draws, annotates, displays and saves a pie chart of a distribution provided as a numeric table. It is a wrapper around ggpubr::ggpie(), with the automation of many features. All ggpubr parameters can be accessed through the ... argument. It can automatically save the plot as png (default) and/or pdf files, and the ggplot object as a .qs file.
Quickly draw and save a bar plot (png, pdf, ggobj.qs). This all-in-one function draws, annotates, displays and saves a bar plot of a distribution provided as a numeric vector. It is a wrapper around ggpubr::ggbarplot(), with the automation of many features. All ggpubr parameters can be accessed through the ... argument. It can automatically save the plot as png (default) and/or pdf files, and the ggplot object as a .qs file.
qbarplot.stacked.from.wide.df - Barplot for tibbles or dataframes. Draw and save a stacked barplot for each row of a dataframe.
qbarplot.df - Barplot for tibbles or dataframes. Draw and save a barplot for tibbles or dataframes
Quickly draw and save a scatter plot (png, pdf, ggobj.qs). This all-in-one function draws, annotates, displays and saves a scatter plot of two variables provided as a 2-column data frame or matrix. It is a wrapper around ggpubr::ggscatter(), with the automation of many features. All ggpubr parameters can be accessed through the ... argument. It can automatically save the plot as png (default) and/or pdf files, and the ggplot object as a .qs file.
Quickly draw and save a boxplot (png, pdf, ggobj.qs). This all-in-one function draws, annotates, displays and saves a boxplot from a two-column data frame or a named list of values. The first column (or list names) is plotted on the X axis, the second column (or list values) on the Y axis. It can automatically save the plot as png (default) and/or pdf files, and the ggplot object as a .qs file.
Quickly draw and save a violin plot (png, pdf, ggobj.qs). This all-in-one function draws, annotates, displays and saves a violin plot from a two-column data frame or a named list of values. The first column (or list names) is plotted on the X axis, the second column (or list values) on the Y axis. It is a wrapper around ggpubr::ggviolin(), with the automation of many features. All ggpubr parameters can be accessed through the ... argument.#' It can automatically save the plot as png (default) and/or pdf files, and the ggplot object as a .qs file.
Quickly draw and save a stripchart (png, pdf, ggobj.qs). This all-in-one function draws, annotates, displays and saves a stripchart from a two-column data frame or a named list of values. The first column (or list names) is plotted on the X axis, the second column (or list values) on the Y axis. It is a wrapper around ggpubr::ggstripchart(), with the automation of many features. All ggpubr parameters can be accessed through the ... argument. It can automatically save the plot as png (default) and/or pdf files, and the ggplot object as a .qs file.
Quickly draw and save a Venn Diagram (png, pdf, ggobj.qs). This all-in-one function draws, annotates, displays and saves a Venn Diagram from a named list of values. It is a wrapper around ggVennDiagram::ggVennDiagram(), with the automation of many features. All ggVennDiagram parameters can be accessed through the ... argument. It can automatically save the plot as png (default) and/or pdf files, and the ggplot object as a .qs file.
Quick Heatmap Plot. Generates a heatmap plot using the ggheatmap package with features such as automatic file saving and markdown link generation. This function simplifies the process of creating and customizing heatmaps, with support for clustering, annotations, and scaling.
Draw and Save a Doubledecker Mosaic Plot. Creates a mosaic-style (doubledecker) stacked bar plot where the X-axis bar width is proportional to the group size and the Y-axis variable determines the color (fill). This function wraps ggmosaic::geom_mosaic() in the style of ggExpress plotting wrappers and supports automatic file saving, Markdown linking, and default color palettes.
qqSave. Quick-Save ggplot objects
q32vA4_grid_plot. Plot up to 6 panels (3-by-2) on vertically standing A4 page.
qA4_grid_plot. Plot up to 6 panels (3-by-1) on vertically standing A4 page.
qMarkdownImageLink. Insert Markdown image link to .md report
qqqAxisLength. Define Axis Length
qqqNamed.Vec.2.Tbl. Convert a named vector to a table.
qqqTbl.2.Vec. Convert a table to a named vector.
qqqList.2.DF.ggplot. Convert a list to a two-column data frame to plot boxplots and violin plots
Assert Maximum Categories in a data frame Column. Checks if the number of unique categories in a column of a dataframe is within the allowed limit.






