Error in vpPathFromVector(names) : A viewport path must contain at least one viewport name

StackOverflow https://stackoverflow.com/questions/13984449

  •  11-12-2021
  •  | 
  •  

Question

Cross posted on Google groups of ggplot:

The below reproducible example of 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)

works perfectly fine on openSUSE 11.4 (64 bit) with sessionInfo() as follows:

> 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      

The same code throws the error (shown in title) when run on Windows Vista with sessionInfo() as follows:

> 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    

The ggplot2 version on Windows is 0.9.2, and on Linux it is 0.9.1.

Is this a known bug, or am I missing a point?

Was it helpful?

Solution

I can reproduce the problem, on windows.

In fact ìn the code of gglocator

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

The grep don't find any grob which contain 'panel-'.

When I remove the -

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" 

For me no reason that this works on linux.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top