statistikZH / statR

ZH-color-scheme & theme_stat template for ggplot2.
https://statistikzh.github.io/statR/
GNU General Public License v3.0
15 stars 1 forks source link

Error in grid.Call "polygon edge not found" #33

Closed larnsce closed 1 year ago

larnsce commented 3 years ago

I have updated statR to the newest version 2.0.0 and get an error when I try to use the example from the references page for "Visualisierungen": https://statistikzh.github.io/statR/articles/Visualisierungen.html

Following is a reproducible example and my session info.

library(statR)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(ggplot2)
library(tidyr)

ggplot(mpg, aes(class,fill = drv))+
  geom_bar()+
  # Default-Spezifikationen innerhalb theme_stat()
  theme_stat(base_size = 11,
             axis.label.pos = "top",
             axis.lines = "x",
             ticks = "x",
             minor.grid.lines = FALSE) +
  labs(title = "Title", subtitle = "Subtitle", caption = "Caption")
#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"

#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): no font could
#> be found for family "arial"
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : no
#> font could be found for family "arial"
#> Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : polygon edge not found
sessionInfo()
#> R version 4.0.4 (2021-02-15)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] tidyr_1.1.3   ggplot2_3.3.5 dplyr_1.0.7   statR_2.0.0  
#> 
#> loaded via a namespace (and not attached):
#>  [1] RColorBrewer_1.1-2 pillar_1.6.1       compiler_4.0.4     highr_0.9         
#>  [5] tools_4.0.4        digest_0.6.27      evaluate_0.14      lifecycle_1.0.0   
#>  [9] tibble_3.1.2       gtable_0.3.0       pkgconfig_2.0.3    rlang_0.4.11      
#> [13] reprex_2.0.0       cli_3.0.0          DBI_1.1.1          rstudioapi_0.13   
#> [17] yaml_2.2.1         xfun_0.24          withr_2.4.2        stringr_1.4.0     
#> [21] knitr_1.33         generics_0.1.0     fs_1.5.0           vctrs_0.3.8       
#> [25] grid_4.0.4         tidyselect_1.1.1   glue_1.4.2         R6_2.5.0          
#> [29] fansi_0.5.0        rmarkdown_2.9      farver_2.1.0       purrr_0.3.4       
#> [33] magrittr_2.0.1     scales_1.1.1       ellipsis_0.3.2     htmltools_0.5.1.1 
#> [37] assertthat_0.2.1   colorspace_2.0-2   labeling_0.4.2     utf8_1.2.1        
#> [41] stringi_1.6.2      munsell_0.5.0      crayon_1.4.1

Created on 2021-07-08 by the reprex package (v2.0.0)

tlorusso commented 3 years ago

Lieber @larnsce - bei uns tritt das Problem so nicht auf bzw. wir können es nicht replizieren. Besteht das Problem bei dir weiterhin? Nehme an, du verfügst auf deinem System über arial?

larnsce commented 2 years ago

Danke noch für deine Antwort @tlorusso. Ich habe es mir heute mal wieder angeschaut und bekomme weiterhin die gleiche Fehlermeldung.

Allerdings scheint es an der Gross/Kleinschreibung des Fonts zu liegen:

library(statR)
library(ggplot2)

# Mit theme_stat() Funktion -> ERROR

ggplot(mpg, aes(class,fill = drv))+
  geom_bar()+
  # Default-Spezifikationen innerhalb theme_stat()
  theme_stat(base_size = 11,
             axis.label.pos = "top",
             axis.lines = "x",
             ticks = "x",
             minor.grid.lines = FALSE) +
  labs(title = "Title", subtitle = "Subtitle", caption = "Caption")

# Mit theme_minimal und "Arial" -> Kein Error

ggplot(mpg, aes(class,fill = drv))+
  geom_bar()+
  theme_minimal(base_family = "Arial")

# Mit theme_minimal und "arial" -> Error

ggplot(mpg, aes(class,fill = drv))+
  geom_bar()+
  theme_minimal(base_family = "arial") 
larnsce commented 2 years ago

In einer RStudio Cloud Instanz bekomme ich es ohne Probleme zum Laufen:

https://rstudio.cloud/content/4316512

Bin auf MacOS und schau mal ob das Problem sonst noch existiert.