diff --git a/R/plotconfiguration-axis.R b/R/plotconfiguration-axis.R index 3e9b1b6a..b4ae5f8b 100644 --- a/R/plotconfiguration-axis.R +++ b/R/plotconfiguration-axis.R @@ -287,7 +287,8 @@ XAxisConfiguration <- R6::R6Class( trans = self$ggplotScale(), breaks = self$prettyTicks(), labels = self$prettyTickLabels(), - expand = self$ggplotExpansion() + expand = self$ggplotExpansion(), + oob = .removeInfiniteValues ) ) # Add special tick lines for pretty log plots @@ -344,7 +345,8 @@ YAxisConfiguration <- R6::R6Class( trans = self$ggplotScale(), breaks = self$prettyTicks(), labels = self$prettyTickLabels(), - expand = self$ggplotExpansion() + expand = self$ggplotExpansion(), + oob = .removeInfiniteValues ) ) # Add special tick lines for pretty log plots diff --git a/R/utilities-axis.R b/R/utilities-axis.R index 39aaea98..a75997b5 100644 --- a/R/utilities-axis.R +++ b/R/utilities-axis.R @@ -215,3 +215,14 @@ getPiTickLabels <- function(ticks) { piLabels[piLabels == ""] <- "0" return(piLabels) } + +#' @title .removeInfiniteValues +#' @description Censor/remove any values outside of range +#' Caution, removing infinite values can cause issues with ribbons +#' which can use such infinite values for filling a range +#' @param x numeric vector of values to manipulate +#' @param range numeric vector of length two giving desired output range +#' @keywords internal +.removeInfiniteValues <- function(x, range = c(0,1)){ + scales::censor(x, range, only.finite = FALSE) +} \ No newline at end of file diff --git a/man/dot-removeInfiniteValues.Rd b/man/dot-removeInfiniteValues.Rd new file mode 100644 index 00000000..004f2642 --- /dev/null +++ b/man/dot-removeInfiniteValues.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utilities-axis.R +\name{.removeInfiniteValues} +\alias{.removeInfiniteValues} +\title{.removeInfiniteValues} +\usage{ +.removeInfiniteValues(x, range = c(0, 1)) +} +\arguments{ +\item{x}{numeric vector of values to manipulate} + +\item{range}{numeric vector of length two giving desired output range} +} +\description{ +Censor any values outside of range +} +\keyword{internal}