vec_force_flat: Make a vector flat

Description Usage Arguments Details Value Examples

View source: R/rescaling.R

Description

Given the standardised name of an aesthetic and limits, force a vector to be a plain numeric number.

Usage

1
2
3
4
vec_force_flat(x, limits = NULL, method = NA_character_)

## Default S3 method:
vec_force_flat(x, limits = NULL, method = NA_character_)

Arguments

x

A vector

limits

The limits for which the minimum should become 0 and the maximum 1.

method

The name of the aesthetic being evaluated.

Details

This is function is often invoked at the very last step before ggplot hands off the data to the grid package and this generic's methods therefore should return a plain numeric between 0-1.

The default coerces x to a numeric and uses scales::rescale to rescale the values to a range between 0 and 1.

Value

A numeric vector between 0-1.

Examples

1
vec_force_flat(5:10, c(0, 15), method = "x")

teunbrand/ggvctrcoords documentation built on Jan. 12, 2020, 6:25 p.m.