我正在使用R
版本3.3.2与ggplot2_2.2.0
和forecast_7.3
(请参阅下面的完整sessionInfo()
)。在我最近的更新后,我遇到了ggtsdisplay()
的一些问题。尽管ggAcf()
和ggPacf()
分开工作,但它没有绘制ACF,ggAcf()
和PACF,ggPacf()
图,因此它也没有图表(也是下面的代码) ),
# install.packages(c("forecast", "zoo", "ggplot2"))
library(forecast)
library(ggplot2)
ggtsdisplay(mdeaths)
# sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Mavericks 10.9.5
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_2.2.0 forecast_7.3 timeDate_3012.100 zoo_1.7-13
[5] colorout_1.1-2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.8 quadprog_1.5-5 lattice_0.20-34 assertthat_0.1
[5] grid_3.3.2 plyr_1.8.4 gtable_0.2.0 scales_0.4.1
[9] lazyeval_0.2.0 tseries_0.10-35 fracdiff_1.4-2 labeling_0.3
[13] tools_3.3.2 munsell_0.4.3 parallel_3.3.2 colorspace_1.3-1
[17] nnet_7.3-12 tibble_1.2
答案 0 :(得分:1)
我用ggplot 2.1.0获得了相同的结果。从函数顶部的参数中键入函数名称和通知,“partial”是默认情节“type”。所以这是一组函数调用:
if (plot.type == "partial") {
lastplot <- ggPacf(x, lag.max = lag.max, na.action = na.action) +
ggplot2::ggtitle(NULL)
acfplotrange <- ggplot2::ggplot_build(acfplot)$panel$ranges[[1]]$y.range
pacfplotrange <- ggplot2::ggplot_build(lastplot)$panel$ranges[[1]]$y.range
yrange <- range(c(acfplotrange, pacfplotrange))
acfplot <- acfplot + ggplot2::ylim(yrange)
lastplot <- lastplot + ggplot2::ylim(yrange)
}
更新到ggplot2到2.2.0在运行3.3.1的Mac上给出了相同的结果。因此,您需要阅读ggplot2的NEWS文件,看看是否有任何已宣布的ggplot_build
更改。我试图找到并失败了。还尝试了http://ggplot2.tidyverse.org网站,该网站没有公告或链接到我能找到的更改。所以我想你需要向ggplot2
和forecast
的维护者发送错误报告。
> maintainer('ggplot2')
[1] "Hadley Wickham <hadley@rstudio.com>"
> maintainer('forecast')
[1] "Rob Hyndman <Rob.Hyndman@monash.edu>"
请记住包含此类信息:
> sessionInfo()
R version 3.3.1 Patched (2016-08-17 r71112)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X El Capitan (10.11.6)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grDevices utils datasets graphics stats methods base
other attached packages:
[1] forecast_7.3 timeDate_3012.100 zoo_1.7-13 rms_4.5-0
[5] SparseM_1.7 Hmisc_3.17-4 ggplot2_2.2.0 Formula_1.2-1
[9] survival_2.40-1 sos_1.3-9 brew_1.0-6 lattice_0.20-33
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 RColorBrewer_1.1-2 plyr_1.8.4
[4] tseries_0.10-35 tools_3.3.1 rpart_4.1-10
[7] tibble_1.2 polspline_1.1.12 gtable_0.2.0
[10] nlme_3.1-128 Matrix_1.2-6 parallel_3.3.1
[13] mvtnorm_1.0-5 gridExtra_2.2.1 cluster_2.0.4
[16] MatrixModels_0.4-1 grid_3.3.1 nnet_7.3-12
[19] data.table_1.9.6 foreign_0.8-66 multcomp_1.4-6
[22] latticeExtra_0.6-28 TH.data_1.0-7 scales_0.4.1
[25] codetools_0.2-14 splines_3.3.1 MASS_7.3-45
[28] assertthat_0.1 colorspace_1.2-6 fracdiff_1.4-2
[31] labeling_0.3 quadprog_1.5-5 quantreg_5.26
[34] sandwich_2.3-4 acepack_1.3-3.3 lazyeval_0.2.0
[37] munsell_0.4.3 chron_2.3-47