prettyGraphics is an R package designed to make the production of prettier plots easier in R. This includes functions which implement prettier versions of many standard plots, such as scatterplots, boxplots and histograms, namely through the creation of prettier axes. Other functions facilitate data exploration (such as the addition of lines coloured by a covariate to a plot), visualisation of statistical models (such as via the addition of model predictions to plots) and plot layout.

Pretty axes

pretty_seq

This function defines pretty sequences, given data, limits and pretty parameters.

pretty_axis

This function defines and adds pretty axes to plots.

pi_notation

This function translates numeric vectors into \(\pi\) notation.

sci_notation

This function translates the 'e' notation used by base R into scientific notation.

add_lagging_point_zero

This function brings all numbers up the the same number of decimal places.

add_grid_rect_xy

This function adds a rectangular grid to a plot at user-defined positions.

Data exploration

add_lines

This function adds lines to a plot, possibly colouring lines by the values of a covariate.

add_colour_bar

This function adds a customisable colour bar legend to a plot.

add_shading_bar

This function adds blocks of shading to a plot to elucidate relationships between a response and explanatory variables, one of which is a factor.

add_shading_quantiles

This functions adds shading for the quantiles of observed variation to a plot.

add_boundary_box

This functions adds a boundary box around observations at specified coordinates.

Statistical inference

summarise_in_bins

This function computes statistical summaries of continuous data in bins.

add_error_bars

This function adds error bars to a plot.

list_CIs

This function lists model predictions/confidence intervals from fitted values and standard errors (or similar).

add_error_envelope

This function adds model predictions (e.g. fitted lines, confidence intervals) to plots.

pretty_smooth_1d

This function plots pretty one-dimensional smooths.

pretty_smooth_2d

This function plots pretty two-dimensional smooths.

Standard plotting functions

pretty_plot

This function creates prettier plots for a variety of functions.

pretty_hist

This function creates prettier histograms.

pretty_boxplot

This function creates prettier boxplots.

pretty_curve

This function evaluates and plots functions.

pretty_mat

This function creates pretty matrices.

pretty_residuals

This function creates prettier diagnostic residual plots.

Temporal data

pretty_line

This function creates pretty number lines and timelines.

define_time_blocks

This function defines 'blocks' (i.e., diel periods or seasons) for each day in a time window.

pretty_ts

This function creates pretty time series plots.

pretty_ts_mat

This function creates 2-dimensional plots of the within and between day variation in a time series.

pretty_pgram

This function creates processed periodogram plots (power spectra).

vis_ts

An interactive Shiny-Dashboard application for the exploration of time series data.

add_moons

This function add moons to a plot of lunar phase.

Spatial data

pretty_map and pretty_map_from_file_raster

These functions create pretty maps of spatial data (in the latter case directly from source files). They are supported by helper functions for adding spatial layers to a background map (see below).

add_sp_raster This function adds rasters to a background map. add_sp_poly This function adds polygons to a background map. add_sp_line This function adds lines to a background map. add_sp_path This function adds paths to a background map. add_sp_points This function adds points to a background map.
summarise_by_lat

This function summarises a raster across latitudinal bands.

add_profile_lat

This function add latitudinal profiles to a plot of a raster.

pretty_scape_3d

This function creates interactive, 3-dimensional visualisations of landscapes/seascapes and/or environmental conditions.

vis_scape_3d

An R Shiny wrapper for pretty_scape_3d.

Colour schemes

pretty_cols_brewer

This function facilitates the creation of pretty colour schemes.

pretty_cols_split_heat

This function generates a `split-heat' colour scheme in which values either side of a break-point are coloured differently.

Plot layout

par_mf

This function defines a suitable plotting window for a given number of plots.

par_tri

This function defines the indices of plots along the lower or upper triangle of a square multi-panel matrix.

Author

Edward Lavender