Create ideal labels and values for a given numeric vector (detects log scales)
auto.axis.Rd
Takes a numeric vector and several parameters and outputs an object with values and labels ideal for given data
Usage
auto.axis(
x,
pretty = TRUE,
log.scaled = NA,
log.zero = 0.1,
max.factor = 1,
min.factor = 1,
include.origin = TRUE,
num.labels = 5,
max.min.log10.diff = 2
)
Arguments
- x
Numeric vector to be scaled
- pretty
Parameter flag for if output should be in pretty format
- log.scaled
parameter set to determine if scaling is logarithmic or not
- log.zero
log 0 starting point
- max.factor
maximum factor for y variable
- min.factor
minimum factor for y variable
- include.origin
flag to include the origin value or not
- num.labels
number of labels to output
- max.min.log10.diff
the max and min diffrence for dataset to be determined logarithmic
Examples
set.seed(223);
simple.data <- data.frame(
x = sample(1:15, 10),
y = LETTERS[1:10]
);
auto.axis(simple.data$x)
#> $log.scaled
#> [1] FALSE
#>
#> $x
#> [1] 9 1 2 7 6 5 13 14 12 3
#>
#> $at
#> [1] 0 5 10 15
#>
#> $axis.lab
#> [1] 0 5 10 15
#>
data2 <- c(1,10,100,1000)
auto.axis(data2)
#> $log.scaled
#> [1] TRUE
#>
#> $x
#> [1] 0 1 2 3
#>
#> $at
#> [1] 0 1 2 3
#>
#> $axis.lab
#> expression(bold("0"), bold("10"^"1"), bold("10"^"2"), bold("10"^"3"))
#>