NEWS


gfplot 0.6.0

Prebuilt binaries for Linux, macOS, and Windows are now available from https://gflab.r-universe.dev/gfplot, so installing no longer needs a compiler. install_github() keeps working unchanged.

Nine new figure families, journal size presets, and a provenance record. Every existing function keeps its name and arguments.

New figure families

The Prediction Performance category is now complete, and five other categories gain their first entries.

| Family | What it answers | | --- | --- | | plot_pr_curve() | Precision against recall, for a rare positive class where the ROC curve can look encouraging | | plot_calibration() | Whether a model is honest about the probability it predicts, not only about the ranking | | plot_decision_curve() | Whether acting on the model does more good than harm, against treating everyone and no one | | plot_cumulative_incidence() | The probability of each event when competing events prevent the one of interest | | plot_volcano() | Effect size against significance, for a differential analysis | | plot_waterfall() | Patients ranked by response, with the RECIST-style cut-offs | | plot_heatmap() | A matrix of values, with a diverging scale centred where it belongs | | plot_confusion() | Predicted against actual class, as counts or row percentages | | plot_violin() | Grouped distributions with the observations shown |

plot_embedding() generalises the projection plots and the wrappers now delegate to it, so PCA, t-SNE, and UMAP share one implementation:

plot_embedding(data, groups, method = "tsne", perplexity = 30, seed = 1)
plot_PCA(data, groups)   # same function, method = "pca"
plot_UMAP(data, groups)  # same function, method = "umap"
plot_tsne(data, groups)  # same function, method = "tsne"

All nine are available through the specification layer as well, and gfplot_families() now indexes 26 figures across 10 categories.

Journal size presets

gfplot_save() takes a size argument using the common column widths, so a figure is produced at the size the journal will print it:

gfplot_save(p, "figure2.png", size = "single")   # 85 mm
gfplot_save(p, "figure2.png", size = "onehalf")  # 114 mm
gfplot_save(p, "figure2.png", size = "double")   # 170 mm
gfplot_save(p, "figure2.png", size = "slide")    # 16:9

An explicit width or height still wins, so a standard width can be paired with a chosen height. Without a preset the previous 7 by 5 inch default applies, so existing calls are unaffected.

Provenance

gfplot_save(..., provenance = TRUE) writes a .provenance.json next to the figure recording what produced it: the figure family when the plot came from a specification, the package and R versions, the output size, device, and font, and the SHA-256 of the written file. That is what makes a figure in a manuscript traceable to the code that drew it. It is off by default so no unexpected files appear.

Repairs

Tests

Three hundred and five tests, adding coverage for every new family, the size presets, and the provenance record.

gfplot 0.5.0

Adds a figure-specification layer and the first new figure family, forest plots. Every existing function keeps its name and arguments.

Figure specifications

gfplot_spec() captures the data and settings for a figure as a value that can be validated, printed, and rendered later, and gfplot_render() draws it. This is the entry point for a pipeline, a report template, or an agent that has the numbers and a description of the chart it wants in one place but draws in another.

spec <- gfplot_spec(
  "forest",
  data = effects, term = "term",
  estimate = "hr", lower = "lower", upper = "upper"
)
gfplot_render(spec)

gfplot_families() indexes every figure the package can draw — both the specification-driven families and the existing functions — with its category and an example call.

Forest plots

plot_forest() draws effect estimates with confidence intervals, the numbers printed alongside, optional grouping, and optional log scaling for ratios. It reads a clinstats regression table without reshaping:

table <- clinstats::cox_table(
  clinstats::clin_crc,
  time = "rfs.delay", event = "rfs.event",
  factors = c("sex", "age", "tnm.stage"), multivariable = "none"
)
plot_forest(
  table,
  term = "term", estimate = "hr_univariable",
  lower = "univ_ci_lower", upper = "univ_ci_upper", p = "univ_p",
  log_scale = TRUE
)

clinstats is listed in Suggests, so it is only needed by that example and the integration test.

Notes

Tests

One hundred and sixty-five tests, adding coverage for the specification layer, the forest plot across both scales, grouped and ungrouped layouts, input validation, and the clinstats integration.

gfplot 0.4.1

gfplot 0.4.0

Adds an explicit style layer, so the house style is defined in one place instead of being restated in every plotting function.

The style layer

Changed defaults

Repairs

Tests

One hundred and twenty-three tests, including coverage for role and alias resolution, palette overrides, risk-group colour matching, theme scaling, and legend wrapping.

Documentation

The README is rewritten around how the package is actually used: what it is for, the house style and why it is opinionated, quick-start examples with figures produced by the package, a function and argument index, and a table of optional back ends with install commands.

gfplot 0.3.0

Modernises the package around two goals: figures come out in Arial without setup, and the package depends on less to maintain.

Fonts no longer need a registration step for most output

In 0.2.0, writing Arial meant running extrafont::font_import() and then extrafont::loadfonts(). That is only needed by the base pdf() device. The raster devices in \pkg{ragg} and the quartz device on macOS resolve system fonts directly, so PNG, TIFF, JPEG, and macOS PDF output need no preparation at all.

Fewer dependencies

Repairs

Documentation

The README is rewritten around how the package is actually used: what it is for, the house style and why it is opinionated, quick-start examples with figures produced by the package, a function and argument index, and a table of optional back ends with install commands.

Tests

Seventy tests, including new coverage for the direction of the plotted curve, force05, the correlation annotation under missing and degenerate input, and gfplot_save().

gfplot 0.2.0

Modernisation of the 0.1.0 package. Every exported function keeps its name and arguments, so existing scripts continue to run unchanged.

Repairs

Dependencies

Behaviour

Tests and continuous integration