From f5fe62c6ab43c94924969b06ce30aec36386ae72 Mon Sep 17 00:00:00 2001 From: davidcarslaw Date: Mon, 29 Jan 2024 12:01:24 +0000 Subject: [PATCH] return scale attribute --- R/polarPlot.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/R/polarPlot.R b/R/polarPlot.R index 885a2792..005c73c3 100644 --- a/R/polarPlot.R +++ b/R/polarPlot.R @@ -1068,6 +1068,9 @@ polarPlot <- labels <- pretty(c(mydata[[x]], upper) + min.scale) ## offset the lines/labels if necessary intervals <- intervals + (min(labels) - min.scale) + + # return radial scale as attribute "radial_scale" on returned data + radial_scale <- intervals ## add zero in the middle if it exists if (min.scale != 0) { @@ -1187,6 +1190,9 @@ polarPlot <- } newdata <- res + + # return attribute of scale used - useful for data with negative scales such as air_temp + attr(newdata, "radial_scale") <- range(radial_scale) output <- list(plot = plt, data = newdata, call = match.call()) class(output) <- "openair"