This is typically the last step when a geom requests a coordinate system to transform the data values between a numeric range between 0 and 1.

S4ForceFlat(x, limits = NULL, aes = "z")

Arguments

x

A vector

limits

A representation of limits

aes

An aesthetic for which to evaluate the flattening.

Value

A numeric vector with values between 0-1

Details

When using a ranged class as x argument, the result can be evaluated differently depending on the aes argument. For example, when x is an IRanges class, setting aes = "xmin" gives rescaled start values and aes = "xmax" gives rescaled end values.

Functions

  • S4ForceFlat,WoodenHorse,ANY-method: Releases the GreekSoldier attribute and call the generic on the result.

  • S4ForceFlat,knownContinuous,numeric-method: Calls scales::rescale.

  • S4ForceFlat,Vector,numeric-method: Attempts to coerce to a vector first.

  • S4ForceFlat,IntegerRanges,numeric-method: for xmin/ymin gives start, for xmax/ymax gives end, otherwise gives midpoint.

  • S4ForceFlat,ANYGenomic,GRanges-method: Linearises seqlevels, then gives start for xmin/ymin and end for xmax/xmax.

Examples

S4ForceFlat(1:5, limits = c(1, 5))
#> [1] 0.00 0.25 0.50 0.75 1.00
# Range classes give different results based on the aes argument require(GenomicRanges) value <- GRanges(c("chr1:10-20", "chr2:10-20")) limits <- GRanges(c("chr1:1-30", "chr2:1-30")) S4ForceFlat(value, limits, aes = "xmin")
#> [1] 0.1475410 0.6557377
S4ForceFlat(value, limits, aes = "xmax")
#> [1] 0.3278689 0.8360656