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.

Methods

Public methods


Method new()

Usage

Scale$new(aesthetics = character(0))

Details

Create a Scale object representing zero or more aesthetics.


Method name()

Usage

Scale$name(x)

Details

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.


Method transform()

Usage

Scale$transform(x)

Details

Transform the user-data vector x. Usually called by $transform_tbl().


Method untransform()

Usage

Scale$untransform(x)

Details

Untransform the transformed-data vector x.


Method train()

Usage

Scale$train(x)

Details

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().


Method reset()

Usage

Scale$reset()

Details

Forget all values that were 'remembered' by $train().


Method map()

Usage

Scale$map(x)

Details

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().


Method transform_tbl()

Usage

Scale$transform_tbl(data)

Details

Call $transform() on the columns of data whose names are included in $aesthetics.


Method untransform_tbl()

Usage

Scale$untransform_tbl(data_trans)

Details

Call $untransform() on the columns of data whose names are included in $aesthetics.


Method train_tbl()

Usage

Scale$train_tbl(data_trans)

Details

Call $train() on the columns of data whose names are included in $aesthetics.


Method map_tbl()

Usage

Scale$map_tbl(data_trans)

Details

Call $map() on the columns of data whose names are included in $aesthetics.


Method breaks()

Usage

Scale$breaks()

Details

Calculate the breaks, which are usually nicely-numbered values around the scale $limits().


Method breaks_minor()

Usage

Scale$breaks_minor()

Details

Calculate the minor breaks, which are usually nicely-numbered values between the scale $breaks() and around the scale $limits().


Method labels()

Usage

Scale$labels()

Details

Calculate the labels associated with the $breaks().


Method limits()

Usage

Scale$limits()

Details

Calculate the scale $limits(), which is usually the range of values observed but could also be set.


Method within_limits()

Usage

Scale$within_limits(x)

Details

Returns a logical vector describing whether or not values in the transformed-data vector x are within the scale $limits().


Method set_guide()

Usage

Scale$set_guide(guide)

Details

Set the Guide that will be used to communicate the relationship between user data values and mapped data values.


Method clone()

The objects of this class are cloneable with this method.

Usage

Scale$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Super class

ggr6::Scale -> ScaleNull

Methods

Public methods

Inherited methods

Method transform()

Usage

ScaleNull$transform(x)


Method untransform()

Usage

ScaleNull$untransform(x)


Method train()

Usage

ScaleNull$train(x)


Method reset()

Usage

ScaleNull$reset()


Method map()

Usage

ScaleNull$map(x)


Method transform_tbl()

Usage

ScaleNull$transform_tbl(data)


Method untransform_tbl()

Usage

ScaleNull$untransform_tbl(data_trans)


Method train_tbl()

Usage

ScaleNull$train_tbl(data_trans)


Method map_tbl()

Usage

ScaleNull$map_tbl(data_trans)


Method breaks()

Usage

ScaleNull$breaks()


Method breaks_minor()

Usage

ScaleNull$breaks_minor()


Method labels()

Usage

ScaleNull$labels()


Method limits()

Usage

ScaleNull$limits()


Method within_limits()

Usage

ScaleNull$within_limits(x)


Method clone()

The objects of this class are cloneable with this method.

Usage

ScaleNull$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.