vpPathFromVector(名称)中的错误:视口路径必须至少包含一个视口名称

时间:2012-12-21 04:51:36

标签: r ggplot2 ggmap

Cross posted on Google groups of ggplot

以下可重现的gglocator(ggplot2)示例:

library(ggplot2)
library(ggmap)
df <- data.frame(xvar = 1:10, yvar = 1:10)
qplot(xvar, yvar, data = df) + annotate(geom = 'point', x = 3, y = 6)
gglocator(4)

使用openSUSE 11.4 (64 bit) sessionInfo()完全正常,如下所示:

> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C            
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8  
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8 
 [7] LC_PAPER=C                 LC_NAME=C               
 [9] LC_ADDRESS=C               LC_TELEPHONE=C          
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C     

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base   

other attached packages:
[1] ggmap_2.1     ggplot2_0.9.1

loaded via a namespace (and not attached):
 [1] colorspace_1.1-1   dichromat_1.2-4    digest_0.5.2       grid_2.15.1     
 [5] labeling_0.1       MASS_7.3-18        memoise_0.1        munsell_0.3     
 [9] plyr_1.7.1         png_0.1-4          proto_0.3-9.2      RColorBrewer_1.0-5
[13] reshape2_1.2.1     RgoogleMaps_1.2.0  rjson_0.2.8        scales_0.2.1    
[17] stringr_0.6      

使用Windows VistasessionInfo()上运行时,相同的代码会抛出错误(显示在标题中),如下所示:

> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252  
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                         
[5] LC_TIME=English_United States.1252   

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

ggplot2上的Windows版本为0.9.2,而Linux上的0.9.1版本为{{1}}。

这是一个已知的错误,还是我错过了一个观点?

1 个答案:

答案 0 :(得分:1)

我可以在Windows上重现这个问题。

实际上是gglocator

的代码
 x <- x[grep("panel-", grid.ls(print = message)[[1]])]

grep找不到任何包含'panel - '的grob。

当我删除 -

x[grep("panel", grid.ls(print = message)[[1]])]
[1] "panel.3-4-3-4"                    "panel.background.rect.5210"       "panel.grid.minor.y.polyline.5212" "panel.grid.minor.x.polyline.5214"
[5] "panel.grid.major.y.polyline.5216" "panel.grid.major.x.polyline.5218" "panel.border.zeroGrob.5207" 

对我来说,毫无理由这适用于linux。