diff --git a/NEWS b/NEWS index e89a766..6264489 100644 --- a/NEWS +++ b/NEWS @@ -22,5 +22,5 @@ * Minor doc updates ## v1.3.0 (17 oct 2018) -* New function `cascadePlot` +* New function `cascadePlot` to visualize the climate change modelling uncertainty cascade. diff --git a/R/cascadePlot.R b/R/cascadePlot.R index 58cf079..47eff4d 100644 --- a/R/cascadePlot.R +++ b/R/cascadePlot.R @@ -39,14 +39,16 @@ #' @param density.reverse Logical (default = TRUE). If TRUE plot the PDF upside down. #' @export +#' @importFrom grDevices rainbow +#' @importFrom graphics segments #' @family visualization functions -#' @author J. Fernandez \email{jesus.fernandez@@unican.es} and M.D. Frias based on the +#' @author J. Fernández \email{jesus.fernandez@@unican.es} and M.D. Frías based on the #' visualization proposed by Ed Hawkins on his Climate Lab Book http://www.climate-lab-book.ac.uk/2014/cascade-of-uncertainty #' #' @references Hawkins E. 2014. Climate Lab Book. http://www.climate-lab-book.ac.uk/2014/cascade-of-uncertainty -#' @references Fernandez, J., Frias, M.D., Cabos, W.D. et al. 2018. Consistency of climate change +#' @references Fernández, J., Frías, M.D., Cabos, W.D. et al. 2018. Consistency of climate change #' projections from multiple global and regional model intercomparison projects. Clim Dyn. https://doi.org/10.1007/s00382-018-4181-8 #' #' @examples \dontrun{ @@ -60,7 +62,6 @@ #' cascadePlot(sdeltas, factors, multimip.stages, title=title, density.offset=2) #' } - cascadePlot <- function(x, factors, stages = NULL, labels = FALSE, label.names = NULL, colors=NULL, title = NULL, line.width = NULL, plot.density = TRUE, density.offset=0, density.reverse=TRUE){ if (is.null(stages)) { stages <- names(factors) diff --git a/R/side.density.R b/R/side.density.R index c6e9e6c..d6b3f06 100644 --- a/R/side.density.R +++ b/R/side.density.R @@ -15,8 +15,9 @@ #' relative to the bottom part of the plot. Default is 0. #' @param density.reverse Logical (default = FALSE). If TRUE plot the PDF upside down. #' @details The function is intended for internal use only. The function adds the PDF to the cascade plot. -#' @author J. Fernandez and M.D. Frias +#' @author J. Fernández and M.D. Frías #' @keywords internal +#' @importFrom stats density side.density <- function(x, horiz=TRUE, col="black", scale=0.1, alpha=0.3, shades = FALSE, prob=c(0.25,0.5,0.75), density.offset=0, density.reverse=FALSE)