Description Methods Super class Methods
Scales convert between the user data space, the data space used
to compute the Stats (transformed data space), and the data space
used by the Geoms (mapped data space) to draw graphical objects.
Scales also compute breaks and labels used in the Guides. Most useful
Scale classes inherit from ScaleSimple, which is designed to leverage
the scales package. Each scale represents zero
or more $aesthetics
(character vector), and contains a $guide
(Guide object) that will be used to communicate the relationship
between user data values and mapped data values. ScaleNull
is a
scale that has infinite limits and never transforms or maps values,
which is useful for testing and for values that should be passed
to the Stat and Geom without being transformed or mapped.
new()
Scale$new(aesthetics = character(0))
Create a Scale object representing zero or more aesthetics
.
name()
Scale$name(x)
Calculate the scale name, which should be a character vector of
length 1. May return waiver()
for when
the scale name should be calculated from the ColumnMapping
. This
method may be removed in favour of this value living in the
Guide.
transform()
Scale$transform(x)
Transform the user-data vector x
. Usually called by
$transform_tbl()
.
untransform()
Scale$untransform(x)
Untransform the transformed-data vector x
.
train()
Scale$train(x)
Train the scale with the transformed-data vector x
.
The range of values observed by the scale are used to
calculate its $limits()
(if these have not been
specified manually). Usually called by $train_tbl()
.
reset()
Scale$reset()
Forget all values that were 'remembered' by $train()
.
map()
Scale$map(x)
Convert the transformed-date vector x
into mapped data
space. This may be a numeric value (for position scales) or
some other vector type (e.g., for colour scales). Usually
called by $map_tbl()
.
transform_tbl()
Scale$transform_tbl(data)
Call $transform()
on the columns of data
whose names
are included in $aesthetics
.
untransform_tbl()
Scale$untransform_tbl(data_trans)
Call $untransform()
on the columns of data
whose names
are included in $aesthetics
.
train_tbl()
Scale$train_tbl(data_trans)
Call $train()
on the columns of data
whose names
are included in $aesthetics
.
map_tbl()
Scale$map_tbl(data_trans)
Call $map()
on the columns of data
whose names
are included in $aesthetics
.
breaks()
Scale$breaks()
Calculate the breaks, which are usually nicely-numbered
values around the scale $limits()
.
breaks_minor()
Scale$breaks_minor()
Calculate the minor breaks, which are usually nicely-numbered
values between the scale $breaks()
and
around the scale $limits()
.
labels()
Scale$labels()
Calculate the labels associated with the $breaks()
.
limits()
Scale$limits()
Calculate the scale $limits()
, which is usually the range
of values observed but could also be set.
within_limits()
Scale$within_limits(x)
Returns a logical vector describing whether or not values in
the transformed-data vector x
are within the scale $limits()
.
set_guide()
Scale$set_guide(guide)
Set the Guide that will be used to communicate the relationship between user data values and mapped data values.
clone()
The objects of this class are cloneable with this method.
Scale$clone(deep = FALSE)
deep
Whether to make a deep clone.
ggr6::Scale
-> ScaleNull
transform()
ScaleNull$transform(x)
untransform()
ScaleNull$untransform(x)
train()
ScaleNull$train(x)
reset()
ScaleNull$reset()
map()
ScaleNull$map(x)
transform_tbl()
ScaleNull$transform_tbl(data)
untransform_tbl()
ScaleNull$untransform_tbl(data_trans)
train_tbl()
ScaleNull$train_tbl(data_trans)
map_tbl()
ScaleNull$map_tbl(data_trans)
breaks()
ScaleNull$breaks()
breaks_minor()
ScaleNull$breaks_minor()
labels()
ScaleNull$labels()
limits()
ScaleNull$limits()
within_limits()
ScaleNull$within_limits(x)
clone()
The objects of this class are cloneable with this method.
ScaleNull$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.