r - 如何使用cowplot创建图表而不激活空白窗口
问题描述
这是一个代表:
require(cowplot)
plot.mpg <- ggplot(mpg, aes(x = cty, y = hwy, colour = factor(cyl))) +
geom_point(size=2.5)
plot.diamonds <- ggplot(diamonds, aes(clarity, fill = cut)) +
geom_bar()+theme(axis.text.x = element_text(angle=70, vjust=0.5))
testing <- plot_grid(plot.mpg, plot.diamonds, labels = c('A', 'B'))
当我运行上述行时,会打开一个空白窗口。我怎样才能禁用它?
我的 sessionInfo 是:
sessionInfo() R 版本 3.4.4 (2018-03-15) 平台:x86_64-pc-linux-gnu (64-bit) 运行于:Ubuntu 14.04.5 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.0
LAPACK: /usr/lib/lapack/liblapack.so.3.0
locale:
[1] LC_CTYPE=en_IN LC_NUMERIC=C LC_TIME=en_IN
[4] LC_COLLATE=en_IN LC_MONETARY=en_IN LC_MESSAGES=en_IN
[7] LC_PAPER=en_IN LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_IN LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] cowplot_0.9.1 ggplot2_2.2.1
loaded via a namespace (and not attached):
[1] labeling_0.3 colorspace_1.3-2 scales_0.5.0 compiler_3.4.4
[5] lazyeval_0.2.1 plyr_1.8.4 gtable_0.2.0 tibble_1.3.4
[9] Rcpp_0.12.15 grid_3.4.4 digest_0.6.13 rlang_0.2.0
[13] munsell_0.4.3
我从 CRAN 下载了 tar 球 - cowplot_0.9.2.tar.gz 并安装了它。我仍然有同样的问题:
我的 sessionInfo 是:
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.0
LAPACK: /usr/lib/lapack/liblapack.so.3.0
locale:
[1] LC_CTYPE=en_IN LC_NUMERIC=C LC_TIME=en_IN
[4] LC_COLLATE=en_IN LC_MONETARY=en_IN LC_MESSAGES=en_IN
[7] LC_PAPER=en_IN LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_IN LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] cowplot_0.9.2 ggplot2_2.2.1.9000
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 viridisLite_0.3.0 digest_0.6.15 withr_2.1.2
[5] grid_3.4.4 plyr_1.8.4 gtable_0.2.0 scales_0.5.0.9000
[9] pillar_1.2.2 rlang_0.2.0.9001 lazyeval_0.2.1 labeling_0.3
[13] munsell_0.4.3 compiler_3.4.4 colorspace_1.3-2 tibble_1.4.2
>
解决方案
从您的会话信息中,我可以看到您正在运行 cowplot 版本 0.9.1。该版本存在特定情况下会弹出空白窗口的问题。如果您升级到 0.9.2(CRAN 上的当前版本),问题应该会消失。
推荐阅读
- python - 从 python 文件编译 .sln 文件并执行活动
- javascript - 如何向 jQuery 小部件“自动完成”添加第二个变量值?
- reactjs - React:为什么我的状态在 useEffect 的初始渲染中未定义?
- ssis - 使用 SQLCMD 执行时如何将字符串参数传递给 SSIS 包
- c# - 在 .Net Core 中基于每个用户使用不同的连接字符串初始化 DBConext
- python-3.x - 在 PyQT 中单击按钮后如何从函数接收返回?
- linux-kernel - 我如何知道哪个文件与内核模块相关联?
- javascript - 构建包含具有开始和结束时间的时间表的 json,以便将它们分组为由开始/结束时间时间表连续性定义的班次
- tensorflow - 从 TensorFlow 中的太多图像创建数据集
- linux - 如何在 Go 守护进程中重新启动自身?