更新到ggplot2 2.0之后,我的一些可视化代码破了,并试图找出原因,这种行为与我有关。在ggplot()的基本调用之后运行内部ggplot2函数(例如geom_point),看起来好像geom_point不从原始ggplot()调用继承数据结构。
示例:
test <- data.frame(a = 1:100, b = 801:900)
ggplot(test, aes(x=a, y=b)) + geom_point()
Error: geom_point requires the following missing aesthetics: x, y
现在每个内部ggplot2调用中这种美学的明确定义是默认行为吗?
会话信息:
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.2 (El Capitan)
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] grid stats4 parallel stats graphics grDevices utils datasets
[9] methods base
other attached packages:
[1] IlluminaHumanMethylation450kanno.ilmn12.hg19_0.2.1
[2] biomaRt_2.26.1
[3] GenomicFeatures_1.22.7
[4] AnnotationDbi_1.32.3
[5] biovizBase_1.18.0
[6] ggbio_1.18.1
[7] cowplot_0.6.0
[8] gridExtra_2.0.0
[9] doParallel_1.0.10
[10] IlluminaHumanMethylation450kmanifest_0.4.0
[11] scales_0.3.0
[12] reshape2_1.4.1
[13] ggplot2_2.0.0
[14] limma_3.26.4
[15] lumi_2.22.0
[16] minfi_1.16.0
[17] bumphunter_1.10.0
[18] locfit_1.5-9.1
[19] iterators_1.0.8
[20] foreach_1.4.3
[21] Biostrings_2.38.3
[22] XVector_0.10.0
[23] SummarizedExperiment_1.0.2
[24] GenomicRanges_1.22.3
[25] GenomeInfoDb_1.6.1
[26] IRanges_2.4.6
[27] S4Vectors_0.8.7
[28] lattice_0.20-33
[29] Biobase_2.30.0
[30] BiocGenerics_0.16.1
loaded via a namespace (and not attached):
[1] nlme_3.1-122 bitops_1.0-6 matrixStats_0.50.1
[4] RColorBrewer_1.1-2 tools_3.2.3 doRNG_1.6
[7] nor1mix_1.2-1 affyio_1.40.0 rpart_4.1-10
[10] KernSmooth_2.23-15 Hmisc_3.17-1 DBI_0.3.1
[13] mgcv_1.8-10 colorspace_1.2-6 nnet_7.3-11
[16] methylumi_2.16.0 GGally_1.0.0 base64_1.1
[19] preprocessCore_1.32.0 graph_1.48.0 pkgmaker_0.22
[22] labeling_0.3 rtracklayer_1.30.1 genefilter_1.52.0
[25] quadprog_1.5-5 affy_1.48.0 RBGL_1.46.0
[28] stringr_1.0.0 digest_0.6.8 Rsamtools_1.22.0
[31] foreign_0.8-66 illuminaio_0.12.0 siggenes_1.44.0
[34] GEOquery_2.36.0 dichromat_2.0-0 BSgenome_1.38.0
[37] RSQLite_1.0.0 BiocInstaller_1.20.1 mclust_5.1
[40] BiocParallel_1.4.3 acepack_1.3-3.3 VariantAnnotation_1.16.4
[43] RCurl_1.95-4.7 magrittr_1.5 Formula_1.2-1
[46] futile.logger_1.4.1 Matrix_1.2-3 Rcpp_0.12.2
[49] munsell_0.4.2 stringi_1.0-1 nleqslv_2.9.1
[52] MASS_7.3-45 zlibbioc_1.16.0 plyr_1.8.3
[55] splines_3.2.3 multtest_2.26.0 annotate_1.48.0
[58] beanplot_1.2 igraph_1.0.1 rngtools_1.2.4
[61] corpcor_1.6.8 codetools_0.2-14 mixOmics_5.2.0
[64] futile.options_1.0.0 XML_3.98-1.3 latticeExtra_0.6-26
[67] lambda.r_1.1.7 gtable_0.1.2 reshape_0.8.5
[70] xtable_1.8-0 survival_2.38-3 OrganismDbi_1.12.1
[73] GenomicAlignments_1.6.3 registry_0.3 ellipse_0.3-8
[76] cluster_2.0.3 rgl_0.95.1441