Skip to content
junjunlabPublic

About

Utility functions for ggplot2: smart axis labels with leader lines, and more

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

ggutils

ggutils logo

R-CMD-check Lifecycle: experimental License: MIT R >= 4.1 ggplot2 >= 4.0 Docs

Small, reusable utilities for ggplot2.

ggutils adds helpers that plug into the usual grammar – no new geometry, no special data format – so a plot keeps being a plot. Each one solves a concrete problem and is documented with runnable examples.

What is inside:

  • guide_axis_smart() – readable labels on crowded axes: pick the labels (which, n), spread them over several rows / columns without overlap, and tie every label back to its tick with a leader line.
  • guide_axis_cluster() / scale_x_cluster() / scale_y_cluster() – hierarchical clustering on the axes: the axis is ordered by the dendrogram and the tree is drawn next to it, one tree per panel with free facets. On a coord_radial() plot the theta tree becomes a ring dendrogram (inside the hole or outside the circle) and a partial arc gets an arc-shaped r-axis tree.
  • facet_gridn() – facet_grid() with scales that are free per panel instead of per row / column.
  • coord_spiral() – an Archimedean spiral coordinate with matching angle and radial axes, for long sequences that would otherwise need many rows.
  • Data and layout helpers – the bundled airway_heatmap, pbmc3k_markers and pbmc3k_dotplot data, plus the exported layout algorithms smart_align(), box_arrange() and smart_stack().

Installation

Requires R >= 4.1 and ggplot2 >= 4.0.0.

# install.packages("remotes")
remotes::install_github("junjunlab/ggutils")

Documentation

Credits

The overlap-free label compaction is a port of smartAlign from circlize; the box arrangement is a port from ComplexHeatmap. The ggplot2 guide integration is new.

About

Utility functions for ggplot2: smart axis labels with leader lines, and more

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages