Axis labels

Use these functions with the labels argument to ggplot2 scales to control the formatting of axis labels and legend keys.

label_bytes()

Label bytes (1 kB, 2 MB, etc)

label_date() label_date_short() label_time() date_format() time_format()

Label date/times

label_dollar() dollar_format() dollar() rescale_short_scale() rescale_long_scale()

Label currencies ($100, $2.50, etc)

label_number() label_comma() comma() number_format() comma_format()

Label numbers in decimal format (e.g. 0.12, 1,234)

label_number_auto()

Label numbers, avoiding scientific notation where possible

label_number_si()

Label numbers with SI prefixes (2 kg, 5 mm, etc)

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

Label ordinal numbers (1st, 2nd, 3rd, etc)

label_parse() label_math() parse_format() math_format()

Label with mathematical annotations

label_percent() percent_format() percent()

Label percentages (2.5%, 50%, etc)

label_pvalue() pvalue_format() pvalue()

Label p-values (e.g. <0.001, 0.25, p >= 0.99)

label_scientific() scientific_format() scientific()

Label numbers with scientific notation (e.g. 1e05, 1.5e-02)

label_wrap() wrap_format()

Label strings by wrapping across multiple lines

Axis breaks

Use these functions with the breaks argument to ggplot2 scales to control the position of axis breaks and values of legend keys.

breaks_extended()

Automatic breaks for numeric axes

breaks_log()

Breaks for log axes

breaks_pretty()

Pretty breaks for date/times

breaks_width()

Equally spaced breaks

minor_breaks_width() minor_breaks_n()

Minor breaks

Bounds: ranges & rescaling

Functions for rescaling data and adjusting scale ranges.

label_dollar() dollar_format() dollar() rescale_short_scale() rescale_long_scale()

Label currencies ($100, $2.50, etc)

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

zero_range()

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

oob_censor() oob_censor_any() oob_discard() oob_squish() oob_squish_any() oob_squish_infinite() oob_keep() censor() discard() squish() squish_infinite()

Out of bounds handling

Transformations

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

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)

log_trans() log10_trans() log2_trans() log1p_trans() pseudo_log_trans()

Log transformations

probability_trans() logit_trans() probit_trans()

Probability transformation

reciprocal_trans()

Reciprocal transformation

reverse_trans()

Reverse transformation

sqrt_trans()

Square-root transformation

time_trans()

Transformation for date-times (class POSIXt)

yj_trans()

Yeo-Johnson transformation

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

muted()

Mute standard colour

alpha()

Modify colour transparency

Non-colour palette functions

Functions to help scale non-colour aesthetics.

area_pal() abs_area()

Area palettes (continuous)

identity_pal()

Identity palette

linetype_pal()

Line type palette (discrete)

manual_pal()

Manual palette (discrete)

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

dscale()

Discrete scale

train_continuous()

Train (update) a continuous scale

train_discrete()

Train (update) a discrete scale

Range

Mutable ranges