facets: better range fixed x axis

This commit is contained in:
pvictor 2021-01-06 09:52:25 +01:00
parent 175271d01a
commit 5679b7cdba
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ set_scale <- function(ax, values, scales = c("fixed", "free", "free_y", "free_x"
if (is.null(values))
return(ax)
if (inherits(values, c("numeric", "integer", "Date", "POSIXt"))) {
range_vals <- range(pretty(values), na.rm = TRUE)
range_vals <- range(pretty(values, n = 10), na.rm = TRUE)
} else {
range_vals <- NULL
}