Skip to contents

These functions format the x and y axes to be consistent with e61 styling. This includes removing white space at the beginning and end of each axis.

Usage

scale_y_continuous_e61(
  limits = NULL,
  sec_axis = ggplot2::dup_axis(),
  rescale_sec = FALSE,
  y_top = TRUE,
  expand_bottom = 0,
  expand_top = 0,
  ...
)

scale_x_continuous_e61(
  limits = NULL,
  expand_left = 0.05,
  expand_right = 0.05,
  hide_first_last = TRUE,
  ...
)

Arguments

limits

One of:

  • A numeric vector of length three providing the limits of the scale and the increment between each axis tick, e.g. c(0, 25, 5) will set the axis to range from 0 to 25, with increments of 5 per tick.

  • A numeric vector of length two providing the minimum and maximum limits of the scale. The break increments will be automatically chosen.

  • NULL to use the default scale range.

sec_axis

Logical. Defaults to duplicating the y-axis so it shows on the left and right. Set to FALSE to hide the secondary axis.

rescale_sec

Logical. Set this to TRUE if you are using a rescaled secondary axis, otherwise leave it as FALSE (default). To add a rescaled secondary axis, see the documentation for sec_rescale.

y_top

Logical. Ensures there is space at the top of the y-axis for the axis label. Defaults to TRUE. Set to FALSE if the axis label is placed elsewhere. If you change this argument you also need to change the argument with the same name in theme_e61.

expand_bottom, expand_top

Numeric. Add extra space between data points and the top/bottom of the graph. See expansion for details.

...

Arguments passed on to ggplot2::scale_y_continuous

name

The name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted.

oob

One of:

  • Function that handles limits outside of the scale limits (out of bounds). Also accepts rlang lambda function notation.

  • The default (scales::censor()) replaces out of bounds values with NA.

  • scales::squish() for squishing out of bounds values into range.

  • scales::squish_infinite() for squishing infinite values into range.

na.value

Missing values will be replaced with this value.

trans

For continuous scales, the name of a transformation object or the object itself. Built-in transformations include "asn", "atanh", "boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2", "logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal", "reverse", "sqrt" and "time".

A transformation object bundles together a transform, its inverse, and methods for generating breaks and labels. Transformation objects are defined in the scales package, and are called <name>_trans (e.g., scales::boxcox_trans()). You can create your own transformation with scales::trans_new().

guide

A function used to create a guide or its name. See guides() for more information.

expand_left, expand_right

Numeric. Add extra space between data points and the left/right of the graph. See expansion for details.

hide_first_last

Logical. Defaults to TRUE. Hides the first and last x-axis labels to avoid overlapping with the bottom of the y-axis.