| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/ggplot2.R |
| 3 |
\name{scale_x_num} |
| 4 |
\alias{scale_x_num} |
| 5 |
\alias{scale_y_num} |
| 6 |
\title{Scale that supports formatted numbers} |
| 7 |
\usage{ |
| 8 |
scale_x_num( |
| 9 |
..., |
| 10 |
position = "bottom", |
| 11 |
guide = ggplot2::waiver(), |
| 12 |
rescaler = NULL, |
| 13 |
super = NULL |
| 14 |
) |
| 15 |
|
| 16 |
scale_y_num(..., guide = ggplot2::waiver(), rescaler = NULL, super = NULL) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{...}{ |
| 20 |
Arguments passed on to \code{\link[ggplot2:continuous_scale]{ggplot2::continuous_scale}} |
| 21 |
\describe{ |
| 22 |
\item{\code{aesthetics}}{The names of the aesthetics that this scale works with.} |
| 23 |
\item{\code{palette}}{A palette function that when called with a numeric vector with |
| 24 |
values between 0 and 1 returns the corresponding output values |
| 25 |
(e.g., \code{\link[scales:pal_area]{scales::pal_area()}}).} |
| 26 |
\item{\code{name}}{The name of the scale. Used as the axis or legend title. If |
| 27 |
\code{waiver()}, the default, the name of the scale is taken from the first |
| 28 |
mapping used for that aesthetic. If \code{NULL}, the legend title will be |
| 29 |
omitted.} |
| 30 |
\item{\code{breaks}}{One of: |
| 31 |
\itemize{ |
| 32 |
\item \code{NULL} for no breaks |
| 33 |
\item \code{waiver()} for the default breaks computed by the |
| 34 |
\link[scales:new_transform]{transformation object} |
| 35 |
\item A numeric vector of positions |
| 36 |
\item A function that takes the limits as input and returns breaks |
| 37 |
as output (e.g., a function returned by \code{\link[scales:breaks_extended]{scales::extended_breaks()}}). |
| 38 |
Note that for position scales, limits are provided after scale expansion. |
| 39 |
Also accepts rlang \link[rlang:as_function]{lambda} function notation. |
| 40 |
}} |
| 41 |
\item{\code{minor_breaks}}{One of: |
| 42 |
\itemize{ |
| 43 |
\item \code{NULL} for no minor breaks |
| 44 |
\item \code{waiver()} for the default breaks (none for discrete, one minor break |
| 45 |
between each major break for continuous) |
| 46 |
\item A numeric vector of positions |
| 47 |
\item A function that given the limits returns a vector of minor breaks. Also |
| 48 |
accepts rlang \link[rlang:as_function]{lambda} function notation. When |
| 49 |
the function has two arguments, it will be given the limits and major |
| 50 |
break positions. |
| 51 |
}} |
| 52 |
\item{\code{n.breaks}}{An integer guiding the number of major breaks. The algorithm |
| 53 |
may choose a slightly different number to ensure nice break labels. Will |
| 54 |
only have an effect if \code{breaks = waiver()}. Use \code{NULL} to use the default |
| 55 |
number of breaks given by the transformation.} |
| 56 |
\item{\code{labels}}{One of the options below. Please note that when \code{labels} is a |
| 57 |
vector, it is highly recommended to also set the \code{breaks} argument as a |
| 58 |
vector to protect against unintended mismatches. |
| 59 |
\itemize{ |
| 60 |
\item \code{NULL} for no labels |
| 61 |
\item \code{waiver()} for the default labels computed by the |
| 62 |
transformation object |
| 63 |
\item A character vector giving labels (must be same length as \code{breaks}) |
| 64 |
\item An expression vector (must be the same length as breaks). See ?plotmath for details. |
| 65 |
\item A function that takes the breaks as input and returns labels |
| 66 |
as output. Also accepts rlang \link[rlang:as_function]{lambda} function |
| 67 |
notation. |
| 68 |
}} |
| 69 |
\item{\code{limits}}{One of: |
| 70 |
\itemize{ |
| 71 |
\item \code{NULL} to use the default scale range |
| 72 |
\item A numeric vector of length two providing limits of the scale. |
| 73 |
Use \code{NA} to refer to the existing minimum or maximum |
| 74 |
\item A function that accepts the existing (automatic) limits and returns |
| 75 |
new limits. Also accepts rlang \link[rlang:as_function]{lambda} function |
| 76 |
notation. |
| 77 |
Note that setting limits on positional scales will \strong{remove} data outside of the limits. |
| 78 |
If the purpose is to zoom, use the limit argument in the coordinate system |
| 79 |
(see \code{\link[ggplot2:coord_cartesian]{coord_cartesian()}}). |
| 80 |
}} |
| 81 |
\item{\code{oob}}{One of: |
| 82 |
\itemize{ |
| 83 |
\item Function that handles limits outside of the scale limits |
| 84 |
(out of bounds). Also accepts rlang \link[rlang:as_function]{lambda} |
| 85 |
function notation. |
| 86 |
\item The default (\code{\link[scales:oob]{scales::censor()}}) replaces out of |
| 87 |
bounds values with \code{NA}. |
| 88 |
\item \code{\link[scales:oob]{scales::squish()}} for squishing out of bounds values into range. |
| 89 |
\item \code{\link[scales:oob]{scales::squish_infinite()}} for squishing infinite values into range. |
| 90 |
}} |
| 91 |
\item{\code{expand}}{For position scales, a vector of range expansion constants used to add some |
| 92 |
padding around the data to ensure that they are placed some distance |
| 93 |
away from the axes. Use the convenience function \code{\link[ggplot2:expansion]{expansion()}} |
| 94 |
to generate the values for the \code{expand} argument. The defaults are to |
| 95 |
expand the scale by 5\% on each side for continuous variables, and by |
| 96 |
0.6 units on each side for discrete variables.} |
| 97 |
\item{\code{na.value}}{Missing values will be replaced with this value.} |
| 98 |
\item{\code{transform}}{For continuous scales, the name of a transformation object |
| 99 |
or the object itself. Built-in transformations include "asn", "atanh", |
| 100 |
"boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2", |
| 101 |
"logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal", |
| 102 |
"reverse", "sqrt" and "time". |
| 103 |
|
| 104 |
A transformation object bundles together a transform, its inverse, |
| 105 |
and methods for generating breaks and labels. Transformation objects |
| 106 |
are defined in the scales package, and are called \verb{transform_<name>}. If |
| 107 |
transformations require arguments, you can call them from the scales |
| 108 |
package, e.g. \code{\link[scales:transform_boxcox]{scales::transform_boxcox(p = 2)}}. |
| 109 |
You can create your own transformation with \code{\link[scales:new_transform]{scales::new_transform()}}.} |
| 110 |
\item{\code{trans}}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Deprecated in favour of |
| 111 |
\code{transform}.} |
| 112 |
\item{\code{call}}{The \code{call} used to construct the scale for reporting messages.} |
| 113 |
}} |
| 114 |
|
| 115 |
\item{guide, position}{Passed on to \code{\link[ggplot2:continuous_scale]{ggplot2::continuous_scale()}}} |
| 116 |
|
| 117 |
\item{rescaler, super}{Must remain \code{NULL}.} |
| 118 |
} |
| 119 |
\description{ |
| 120 |
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} |
| 121 |
|
| 122 |
This scale is used by default in ggplot2 with columns created with \code{\link[=num]{num()}}. |
| 123 |
} |
| 124 |
\keyword{internal} |