Breaks and formatters

Functions for computing how tick marks/legend keys should be distributed across the data range, as well as how to convert those numeric positions into reader-friendly labels

date_breaks()

Regularly spaced dates.

extended_breaks()

Extended breaks. Uses Wilkinson's extended breaks algorithm as implemented in the labeling package.

log_breaks()

Log breaks (integer breaks on log-transformed scales).

pretty_breaks()

Pretty breaks. Uses default R break algorithm as implemented in pretty().

regular_minor_breaks()

Minor breaks. Places minor breaks between major breaks.

trans_breaks()

Pretty breaks on transformed scale.

date_format() time_format()

Formatted dates and times.

dollar_format() dollar()

Currency formatter: round to nearest cent and display dollar sign.

format_format()

Format with using any arguments to format().

math_format()

Add arbitrary expression to a label. The symbol that will be replace by the label value is .x.

number_bytes_format() number_bytes()

Bytes formatter: convert to byte measurement and display symbol.

number_format() number() comma_format() comma() percent_format() percent() unit_format()

Number formatters

ordinal_format() ordinal() ordinal_english() ordinal_french() ordinal_spanish()

Ordinal formatter: add ordinal suffixes (-st, -nd, -rd, -th) to numbers.

parse_format()

Parse a text label to produce expressions for plotmath.

pvalue_format() pvalue()

p-values formatter

scientific_format() scientific()

Scientific formatter.

trans_format()

Format labels after transformation.

wrap_format()

Wrap text to a specified width, adding newlines for spaces if text exceeds the width

Bounds: ranges & rescaling

Functions for rescaling data and adjusting scale ranges.

rescale()

Rescale continuous vector to have specified minimum and maximum.

rescale_max()

Rescale numeric vector to have specified maximum.

rescale_mid()

Rescale vector to have specified minimum, midpoint, and maximum.

rescale_none()

Don't perform rescaling

rescale_pal()

Rescale palette (continuous).

expand_range()

Expand a range with a multiplicative or additive constant.

trans_range()

Compute range of transformed values.

zero_range()

Determine if range of vector is close to zero, with a specified tolerance

squish()

Squish values into range.

squish_infinite()

Squish infinite values to range.

discard()

Discard any values outside of range.

censor()

Censor any values outside of range.

Transformations

Functions to describe common and custom scale transformations their inverses, and ways of generating breaks and labels.

as.trans()

Convert character string to transformer.

asn_trans()

Arc-sin square root transformation.

atanh_trans()

Arc-tangent transformation.

boxcox_trans() modulus_trans()

Box-Cox & modulus transformations.

date_trans()

Transformation for dates (class Date).

exp_trans()

Exponential transformation (inverse of log transformation).

hms_trans()

Transformation for times (class hms).

identity_trans()

Identity transformation (do nothing).

log1p_trans()

Log plus one transformation.

log_trans()

Log transformation.

probability_trans()

Probability transformation.

pseudo_log_trans()

Pseudo-log transformation

reciprocal_trans()

Reciprocal transformation.

reverse_trans()

Reverse transformation.

sqrt_trans()

Square-root transformation.

time_trans()

Transformation for date-times (class POSIXt).

trans_format()

Format labels after transformation.

trans_new()

Create a new transformation object.

trans_range()

Compute range of transformed values.

Colour palettes & colour mapping

Functions for specifying colour palettes, colour mapping, and various helper functions.

brewer_pal()

Colour Brewer palette (discrete).

dichromat_pal()

Dichromat (colour-blind) palette (discrete).

div_gradient_pal()

Diverging colour gradient (continuous).

gradient_n_pal()

Arbitrary colour gradient palette (continuous).

grey_pal()

Grey scale palette (discrete).

hue_pal()

Hue palette (discrete).

seq_gradient_pal()

Sequential colour gradient palette (continuous).

rescale_pal()

Rescale palette (continuous).

viridis_pal()

Viridis palette

col2hcl()

Modify standard R colour in hcl colour space.

col_numeric() col_bin() col_quantile() col_factor()

Colour mapping

colour_ramp()

Fast colour interpolation

show_col()

Show colours.

muted()

Mute standard colour.

alpha()

Modify colour transparency. Vectorised in both colour and alpha.

Non-colour palette functions

Functions to help scale non-colour aesthetics.

abs_area()

Point area palette (continuous), with area proportional to value.

area_pal()

Point area palette (continuous).

identity_pal()

Identity palette.

linetype_pal()

Line type palette (discrete).

manual_pal()

Manual palette (manual).

rescale_pal()

Rescale palette (continuous).

shape_pal()

Shape palette (discrete).

Creating your own scales and mutable ranges

Scales control the details of how data values are translated to visual properties. The following functions help users create (and update) custom scales: pulling together palettes, bounding functions and transformations to provide a complete pathway from raw data to perceptual properties.

cscale()

Continuous scale.

cbreaks()

Compute breaks for continuous scale.

dscale()

Discrete scale.

train_continuous()

Train (update) a continuous scale

train_discrete()

Train (update) a discrete scale

Range

Mutable ranges.