Basics

ggpmisc is based on the grammar of graphics implemented in ggplot2, the idea that you can build every graph from the same components: a data set, a coordinate system, and geoms---visual marks that represent data points. If you are not already familiar with this grammar and ggplot2 you should visit the ggplot2 Cheat Sheet first, and afterwards come back to this Cheat Sheet.

Differently to ggplot2, no geometries with the new stats as default are provided. The plot layers described here are always added with a stat, and when necessary, their default geom argument can be overridden. The default geoms for the statistics described below are from packages ggplot2 and ggpp.

library(ggpmisc)

Most of the layer functions in ggpmisc aim at making it easier to add to plots information derived from model fitting, tests of significance and some summaries. All layer functions work as expected with groups and facets.

Correlation

Fitted lines

In general these layer functions have additional features than those in ggplot2 or support different kinds of models. They add one or more curves and confidence band.

Fitted equations and parameters

These layer functions have no equivalent in ggplot2. They flexibly construct labels to add a layer with one or more equations and/or estimates of parameters a fitted model. In the model is a true polynomial, the "label" can be formatted to be parsed into an R expression, or as $LaTeX$ or $markdown$ encoded character strings. The numeric values of the estimates are also returned and can be used to construct a label within a call to aes().

ANOVA or summary tables

Multiple comparisons

Peaks and valleys

Volcano and quadrant plots

These plots are frequently used with gene expression data, and each of the many genes labelled based on the ternary outcome from a statistical test. Data are usually, in addition transformed. ggpmisc provides several variations on continuous, colour, fill and shape scales, with defaults set as needed. Scales support log fold-change (logFC), false discovery ratio (FDR), P-value (Pvalue) and binary or ternary test outcomes (outcome).

Utility functions

Most of the functions used to generate formatted labels in layers and scales are also exported.


Learn more at docs.r4photobiology.info/ggpmisc.




aphalo/ggpmisc documentation built on April 13, 2025, 3:24 a.m.