README.md

prettyGraphics

Project Status: Active – The project has reached a stable, usable
state and is being actively
developed. CRAN_Status_Badge R-CMD-check pkgdown

prettyGraphics is an R package designed to make the production of plots and data exploration easier, more flexible and prettier. prettyGraphics has been particularly inspired by the requirements of continuous ecological datasets. The package includes multiple ‘building block’ functions which help to define the initial arguments of a plot and then add elements to a plot in sequence. Some integrative functions draw on the flexibility of building blocks to define prettier plots for a variety of equivalent plotting functions in base R (e.g. graphics::plot(), graphics::hist() and more) or more specialised routines. Key functionality includes:

Installation

You can install the development version of prettyGraphics from GitHub with:

devtools::install_github("edwardlavender/prettyGraphics", dependencies = TRUE, build_vignette = TRUE)

If you build the vignette, you can view this with vignette("introducing_prettyGraphics", package = "prettyGraphics"). The package can then be loaded and attached with:

library(prettyGraphics)

The definition of pretty axes

Data exploration

Statistical inference

Standard plotting functions

Here are some simple examples in which the default graphics and prettyGraphics plots are compared:

# Simulate some data 
n <- 100
x <- factor(sample(1:3, n, replace = TRUE))
y <- stats::rnorm(n, 0, 1)
# Compare graphics and prettyGraphics defaults for some example plots 
pp <- par(mfrow = c(1, 6), mar = c(2, 2, 2, 2))
plot.default(x, y, main = "[default] plot(x, y)")
pretty_plot(x, y, main = "pretty_plot(x, y)")
hist(y, main = "[default] hist(x)")
pretty_hist(y, main = "pretty_hist(x)")
boxplot(y ~ x, main = "[default] boxplot(y ~ x)")
pretty_boxplot(x, y, main = "pretty_boxplot(x, y)")

par(pp)

Temporal data

Spatial data

Colour schemes

Plot layout

Tidy tables

Future functionality

Possible future functionality includes:

Disclaimer

prettyGraphics is a new package whose contents are an early stage of evolution and primarily driven by the author’s ecological research. Please report issues, comments and suggestions!



edwardlavender/prettyGraphics documentation built on Jan. 19, 2025, 2:47 p.m.