From 13701fc293c7bcc341d133a7be34f21eec2940ed Mon Sep 17 00:00:00 2001 From: Joshua Ulrich Date: Wed, 31 Jan 2024 16:57:03 -0600 Subject: [PATCH] Use ylim_render when drawing legend This avoids an error when adding a legend when 'log = TRUE'. Fixes #407. --- R/plot.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/plot.R b/R/plot.R index dfc4ad0..61624dc 100644 --- a/R/plot.R +++ b/R/plot.R @@ -742,7 +742,8 @@ addLegend <- function(legend.loc="topright", legend.names=NULL, col=NULL, ncol=1 if(is.na(on[1])){ yrange <- c(0, 1) } else { - yrange <- x$get_panel(on)$ylim + panel <- x$get_panel(on) + yrange <- panel$ylim_render } # this just gets the data of the main plot # TODO: get the data of panels[on]