oswaldosantos / ggsn

R package to add north symbols and scale bars to maps created with ggplot or ggmap
http://oswaldosantos.github.io/ggsn/
GNU General Public License v2.0
161 stars 9 forks source link

Package not working #39

Closed gregor-d closed 6 years ago

gregor-d commented 6 years ago

Hello, it seems like the package is not working anymore. If I execute the example-code, I get this error-message Error in grid.Call.graphics(C_setviewport, vp, TRUE) : non-finite location and/or size for viewport In addition: There were 21 warnings (use warnings() to see them)

Example Code


dsn <- system.file('extdata', package = 'ggsn')
map <- st_read(dsn, 'sp', quiet = TRUE)
map2 <- st_transform(map, 31983)

(ggm1 <- ggplot(map, aes(fill = nots)) +
    geom_sf() +
    scale_fill_brewer(name = 'Animal abuse\nnotifications', palette = 8))

ggm1 +
  blank() +
  north(map) +
  scalebar(map, dist = 5, dd2km = TRUE, model = 'WGS84')```

Here is my session info

```r 
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

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

other attached packages:
[1] sf_0.6-3      ggsn_0.4.0    ggplot2_3.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18       RColorBrewer_1.1-2 pillar_1.3.0       compiler_3.5.0     plyr_1.8.4        
 [6] bindr_0.1.1        class_7.3-14       tools_3.5.0        digest_0.6.15      tibble_1.4.2      
[11] gtable_0.2.0       lattice_0.20-35    pkgconfig_2.0.1    png_0.1-7          rlang_0.2.1       
[16] DBI_1.0.0          rstudioapi_0.7     yaml_2.1.19        bindrcpp_0.2.2     spData_0.2.9.0    
[21] e1071_1.6-8        withr_2.1.2        dplyr_0.7.6        classInt_0.2-3     grid_3.5.0        
[26] tidyselect_0.2.4   glue_1.3.0         R6_2.2.2           foreign_0.8-70     sp_1.3-1          
[31] purrr_0.2.5        magrittr_1.5       scales_0.5.0       maptools_0.9-2     units_0.6-0       
[36] assertthat_0.2.0   colorspace_1.3-2   lazyeval_0.2.1     munsell_0.5.0      crayon_1.3.4  `
gregor-d commented 6 years ago

Okay the problem ist the CRAN-Version of this package, it is working with the developer version.