浏览代码

invisibly return component plots (#11)

This will make it easier for users to change the theme or other aspects of the plots, and shouldn't affect any existing behavior because the returned object is invisible.
David J. Harris 8 年之前
父节点
当前提交
3548546b65
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      R/R/prophet.R

+ 3 - 0
R/R/prophet.R

@@ -919,6 +919,8 @@ plot.prophet <- function(x, fcst, uncertainty = TRUE, xlabel = 'ds',
 #' @param uncertainty Boolean indicating if the uncertainty interval should be
 #' @param uncertainty Boolean indicating if the uncertainty interval should be
 #'  plotted for the trend, from fcst columns trend_lower and trend_upper.
 #'  plotted for the trend, from fcst columns trend_lower and trend_upper.
 #'
 #'
+#' @return Invisibly return a list containing the plotted ggplot objects
+#'
 #' @export
 #' @export
 #' @importFrom dplyr "%>%"
 #' @importFrom dplyr "%>%"
 prophet_plot_components <- function(m, fcst, uncertainty = TRUE) {
 prophet_plot_components <- function(m, fcst, uncertainty = TRUE) {
@@ -945,6 +947,7 @@ prophet_plot_components <- function(m, fcst, uncertainty = TRUE) {
     print(panels[[i]], vp = grid::viewport(layout.pos.row = i,
     print(panels[[i]], vp = grid::viewport(layout.pos.row = i,
                                            layout.pos.col = 1))
                                            layout.pos.col = 1))
   }
   }
+  return(invisible(panels))
 }
 }
 
 
 #' Plot the prophet trend.
 #' Plot the prophet trend.