From 6523b545926efa2cc14cca5b6a4fc4ec00cb0763 Mon Sep 17 00:00:00 2001 From: Joshua Ulrich Date: Sat, 13 Jul 2024 16:19:48 -0500 Subject: [PATCH] Handle case when ylim is constant and negative 'lim' was in reverse order when the ylim max/min were the same and negative. This change makes sure they are in the correct order. Thanks to Ethan Smith for the report! Fixes #422. --- R/plot.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/plot.R b/R/plot.R index c374336..64d7d69 100644 --- a/R/plot.R +++ b/R/plot.R @@ -1248,7 +1248,8 @@ new.replot_xts <- function(panel=1,asp=1,xlim=c(1,10),ylim=list(structure(c(1,10 if(lim[1L] == 0) { lim <- c(-1, 1) } else { - lim <- lim[1L] * c(1 - const_y_mult, 1 + const_y_mult) + adj <- sign(lim[1L]) * const_y_mult + lim <- lim[1L] * c(1 - adj, 1 + adj) } }