From 8929d1b993581809a4f3d644088421f5d12dddd1 Mon Sep 17 00:00:00 2001 From: "Arnaud M. Wolfer" Date: Mon, 12 Dec 2022 00:34:39 +0100 Subject: [PATCH] ggplot2 depreciation warning --- R/plotHistogram.R | 2 +- R/zzz.R | 2 +- inst/NEWS | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/R/plotHistogram.R b/R/plotHistogram.R index daa50a2..f5bd4c1 100644 --- a/R/plotHistogram.R +++ b/R/plotHistogram.R @@ -19,7 +19,7 @@ plotHistogram <- function(var, varName = "Variable", density = TRUE, ...) { # with density if (density) { p_hist <- p_hist + - ggplot2::geom_histogram(ggplot2::aes(y = ..density..), + ggplot2::geom_histogram(ggplot2::aes(y=ggplot2::after_stat(density)), colour = "black", fill = "white", ...) + ggplot2::geom_density(alpha = 0.1, fill = "blue") # without density diff --git a/R/zzz.R b/R/zzz.R index 65f31b9..f1d29d9 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -6,7 +6,7 @@ utils::globalVariables( # data.frame column names used in ggplot (cannot use aes_string due to # transformations to the column in aes()) - c("x","y","colr","..density..","rt","int","specID", "rt_dev_sec", + c("x","y","colr","rt","int","specID", "rt_dev_sec", "isReference", "predictedRtDrift") ) invisible() diff --git a/inst/NEWS b/inst/NEWS index 3709ad4..65ac3a9 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -1,4 +1,5 @@ Changes in version 1.13.1 (2022-12-11) - Bugfix: plotHistogram changing warning message - Bugfix: peakPantheR_plotPeakwidth issue due to ggplot2 behaviour changes for - date axis \ No newline at end of file + date axis +- Depreciation warning from ggplot2 `..density..` to `after_stat()` \ No newline at end of file