Closed IndrajeetPatil closed 3 years ago
I am not sure whether this is related (therefore didn't open a new issue), but image_ggplot()
is also no longer working on Windows (magick 2.4.0).
It zooms and rotates the images:
library(ggplot2)
myplot <- image_ggplot(logo)
myplot + ggtitle("Test plot")
Thanks for reporting these things. These things have to do with the new graphics device in R 4.1.
Does the ggplot2 problem also appear in R 4.0 or only 4.1?
thanks for following up @jeroen. The bug I mentioned does also happen with R4.0.
sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18362)
I also have another windows machine with R 3.6 and thought that the error occurs on this machine as well. Will try and let you know soon.
@jeron I ran the same code on my other windows machine and can now confirm that the bug also exists for R3.6.1! Image looks exactly as shown above.
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] scales_1.1.0 viridis_0.5.1 viridisLite_0.3.0 AER_1.2-8 survival_2.44-1.1 sandwich_2.5-1
[7] lmtest_0.9-37 zoo_1.8-6 car_3.0-5 quanteda_2.0.1 tidytext_0.2.2 lubridate_1.7.4
[13] stargazer_5.2.2 hrbrthemes_0.6.0 effects_4.1-4 carData_3.0-3 ggeffects_0.15.1 cowplot_1.0.0
[19] ggrepel_0.8.2 magick_2.4.0 sjPlot_2.8.1 extrafont_0.17 forcats_0.4.0 stringr_1.4.0
[25] dplyr_0.8.3 purrr_0.3.3 readr_1.3.1 tidyr_1.0.0 tibble_2.1.3 ggplot2_3.3.0
[31] tidyverse_1.3.0 MASS_7.3-51.4
loaded via a namespace (and not attached):
[1] minqa_1.2.4 colorspace_1.4-1 rio_0.5.16 sjlabelled_1.1.6 estimability_1.3
[6] parameters_0.3.0 fs_1.3.1 rstudioapi_0.11 SnowballC_0.6.0 fansi_0.4.0
[11] mvtnorm_1.0-11 xml2_1.2.2 splines_3.6.1 mnormt_1.5-5 knitr_1.26
[16] sjmisc_2.8.2 zeallot_0.1.0 Formula_1.2-3 jsonlite_1.6.1 nloptr_1.2.1
[21] broom_0.5.2 Rttf2pt1_1.3.7 dbplyr_1.4.2 effectsize_0.0.1 compiler_3.6.1
[26] httr_1.4.1 sjstats_0.17.7 emmeans_1.4.3.01 backports_1.1.5 assertthat_0.2.1
[31] Matrix_1.2-17 survey_3.36 cli_2.0.2 htmltools_0.4.0.9003 tools_3.6.1
[36] coda_0.19-3 gtable_0.3.0 glue_1.4.0 fastmatch_1.1-0 Rcpp_1.0.4.6
[41] cellranger_1.1.0 vctrs_0.2.0 nlme_3.1-140 extrafontdb_1.0 psych_1.8.12
[46] insight_0.9.0 xfun_0.11 stopwords_1.0 openxlsx_4.1.3 lme4_1.1-21
[51] rvest_0.3.5 lifecycle_0.1.0 hms_0.5.2 parallel_3.6.1 curl_4.3
[56] gridExtra_2.3 gdtools_0.2.1 stringi_1.4.3 bayestestR_0.4.0 tokenizers_0.2.1
[61] boot_1.3-22 zip_2.0.4 rlang_0.4.5 pkgconfig_2.0.3 systemfonts_0.1.1
[66] evaluate_0.14 lattice_0.20-38 tidyselect_0.2.5 magrittr_1.5 R6_2.4.1
[71] generics_0.0.2 DBI_1.0.0 pillar_1.4.2 haven_2.2.0 foreign_0.8-71
[76] withr_2.2.0 abind_1.4-5 nnet_7.3-12 performance_0.4.0 janeaustenr_0.1.5
[81] modelr_0.1.5 crayon_1.3.4 rmarkdown_1.18 grid_3.6.1 readxl_1.3.1
[86] data.table_1.12.6 reprex_0.3.0 digest_0.6.25 xtable_1.8-4 RcppParallel_4.4.4
[91] munsell_0.5.0 mitools_2.4
Let me know if you need other info.
Is there any workaround to this problem other than installing older R and magick versions?
The upside-down bug is an issue in ggplot2, see issue: https://github.com/ropensci/magick/issues/266#issuecomment-707095927
I cannot reproduce the error in the top post. Maybe it was temporary, because if the examples would fail in R-devel we should see this on CRAN as well.
I still observe it with the latest version of R-devel (r79310
):
set.seed(123)
library(magick)
#> Linking to ImageMagick 6.9.9.14
#> Enabled features: cairo, freetype, fftw, ghostscript, lcms, pango, rsvg, webp
#> Disabled features: fontconfig, x11
# Regular image
frink <- image_read("https://jeroen.github.io/images/frink.png")
# Produce image using graphics device
fig <- image_graph(res = 96)
#> Error in magick_device_internal(bg = bg, width = width, height = height, : Graphics API version mismatch
sessioninfo::session_info(include_base = TRUE)
#> - Session info ---------------------------------------------------------------
#> setting value
#> version R Under development (unstable) (2020-10-07 r79310)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.1252
#> ctype English_United States.1252
#> tz Europe/Berlin
#> date 2020-10-12
#>
#> - Packages -------------------------------------------------------------------
#> ! package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.1.0)
#> backports 1.1.10 2020-09-15 [1] CRAN (R 4.1.0)
#> base * 4.1.0 2020-10-08 [?] local
#> cli 2.0.2 2020-02-28 [1] CRAN (R 4.1.0)
#> P compiler 4.1.0 2020-10-08 [2] local
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.1.0)
#> curl 4.3 2019-12-02 [1] CRAN (R 4.1.0)
#> P datasets * 4.1.0 2020-10-08 [2] local
#> digest 0.6.25 2020-02-23 [1] CRAN (R 4.1.0)
#> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.1.0)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.0)
#> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.1.0)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.0)
#> P graphics * 4.1.0 2020-10-08 [2] local
#> P grDevices * 4.1.0 2020-10-08 [2] local
#> highr 0.8 2019-03-20 [1] CRAN (R 4.1.0)
#> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.1.0)
#> knitr 1.30 2020-09-22 [1] CRAN (R 4.1.0)
#> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.1.0)
#> magick * 2.4.0 2020-06-23 [1] CRAN (R 4.1.0)
#> magrittr 1.5.0.9000 2020-09-03 [1] Github (tidyverse/magrittr@15f6f07)
#> P methods * 4.1.0 2020-10-08 [2] local
#> pillar 1.4.6 2020-07-10 [1] CRAN (R 4.1.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
#> Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.1.0)
#> reprex 0.3.0.9001 2020-08-15 [1] Github (tidyverse/reprex@23a3462)
#> rlang 0.4.8 2020-10-08 [1] CRAN (R 4.1.0)
#> rmarkdown 2.4 2020-09-30 [1] CRAN (R 4.1.0)
#> rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.1.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.0)
#> P stats * 4.1.0 2020-10-08 [2] local
#> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.1.0)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0)
#> styler 1.3.2.9000 2020-09-19 [1] Github (r-lib/styler@3555174)
#> tibble 3.0.3 2020-07-10 [1] CRAN (R 4.1.0)
#> P tools 4.1.0 2020-10-08 [2] local
#> P utils * 4.1.0 2020-10-08 [2] local
#> vctrs 0.3.4 2020-08-29 [1] CRAN (R 4.1.0)
#> withr 2.3.0 2020-09-22 [1] CRAN (R 4.1.0)
#> xfun 0.18 2020-09-29 [1] CRAN (R 4.1.0)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.0)
#>
#> [1] C:/Users/inp099/Documents/R/win-library/4.1
#> [2] C:/Program Files/R/R-devel/library
#>
#> P -- Loaded and on-disk path mismatch.
Did you reinstall magick? It looks like you're using a version of magick that was compiled with an older R.
You are right! I reinstalled it again and I no longer observe this issue.
Reprex
Created on 2020-08-06 by the reprex package (v0.3.0)
Session info
devtools::session_info() #> - Session info --------------------------------------------------------------- #> setting value #> version R Under development (unstable) (2020-07-22 r78897) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.1252 #> ctype English_United States.1252 #> tz Europe/Berlin #> date 2020-08-06 #> #> - Packages ------------------------------------------------------------------- #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.1.0) #> backports 1.1.8 2020-06-17 [1] CRAN (R 4.1.0) #> callr 3.4.3 2020-03-28 [1] CRAN (R 4.1.0) #> cli 2.0.2 2020-02-28 [1] CRAN (R 4.1.0) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.1.0) #> curl 4.3 2019-12-02 [1] CRAN (R 4.1.0) #> desc 1.2.0 2018-05-01 [1] CRAN (R 4.1.0) #> devtools 2.3.1 2020-07-21 [1] CRAN (R 4.1.0) #> digest 0.6.25 2020-02-23 [1] CRAN (R 4.1.0) #> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.1.0) #> evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.0) #> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.1.0) #> fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0) #> glue 1.4.1 2020-05-13 [1] CRAN (R 4.1.0) #> highr 0.8 2019-03-20 [1] CRAN (R 4.1.0) #> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.1.0) #> knitr 1.29 2020-06-23 [1] CRAN (R 4.1.0) #> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.1.0) #> magick * 2.4.0 2020-06-23 [1] CRAN (R 4.1.0) #> magrittr 1.5 2014-11-22 [1] CRAN (R 4.1.0) #> memoise 1.1.0 2017-04-21 [1] CRAN (R 4.1.0) #> pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.1.0) #> pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.1.0) #> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.0) #> processx 3.4.3 2020-07-05 [1] CRAN (R 4.1.0) #> ps 1.3.3 2020-05-08 [1] CRAN (R 4.1.0) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0) #> R6 2.4.1 2019-11-12 [1] CRAN (R 4.1.0) #> Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.1.0) #> remotes 2.2.0 2020-07-21 [1] CRAN (R 4.1.0) #> rlang 0.4.7 2020-07-09 [1] CRAN (R 4.1.0) #> rmarkdown 2.3 2020-06-18 [1] CRAN (R 4.1.0) #> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.1.0) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.0) #> stringi 1.4.6 2020-02-17 [1] CRAN (R 4.1.0) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0) #> testthat 2.3.2 2020-03-02 [1] CRAN (R 4.1.0) #> usethis 1.6.1.9001 2020-07-28 [1] Github (r-lib/usethis@03afbc8) #> withr 2.2.0 2020-04-20 [1] CRAN (R 4.1.0) #> xfun 0.16 2020-07-24 [1] CRAN (R 4.1.0) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.0) #> #> [1] C:/Users/inp099/Documents/R/win-library/4.1 #> [2] C:/Program Files/R/R-devel/libraryTrace