Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

png error in creating in using sticker function #133

Open
JobNmadu opened this issue May 30, 2021 · 6 comments
Open

png error in creating in using sticker function #133

JobNmadu opened this issue May 30, 2021 · 6 comments

Comments

@JobNmadu
Copy link

I have installed hexsticker on my machine currently using R41. I have been trying to create sticker using the example sticker and i get this error:

Error in png_dev(..., res = dpi, units = "in") :
unused arguments (type = "cairo-png", antialias = "subpixel")

I started trying it while using R40. What is the error and how can it be fixed?

I have re-installed hexsticker using the dev version and also re-installed cairo, cairodevice

@JobNmadu
Copy link
Author

some edits of the title

@GuangchuangYu
Copy link
Owner

> f = tempfile(fileext='.png')
> library(hexSticker)
s <- sticker(~plot(cars, cex=.5, cex.axis=.5, mgp=c(0,.3,0), xlab="", ylab=""),
          package="hexSticker", p_size=20, s_x=.8, s_y=.6, s_width=1.4, s_height=1.2,filename = f)
> file.info(f)
                                      size isdir mode               mtime
/tmp/Rtmp6tMJTc/file97c122462f93.png 45227 FALSE  644 2021-06-01 10:28:45
                                                   ctime               atime
/tmp/Rtmp6tMJTc/file97c122462f93.png 2021-06-01 10:28:45 2021-06-01 10:28:45
                                      uid gid uname grname
/tmp/Rtmp6tMJTc/file97c122462f93.png 1000 985   ygc  users

works fine here.

pls provide reproducible example.

@JobNmadu
Copy link
Author

JobNmadu commented Jun 1, 2021

library(hexSticker)
library(ggplot2)
p <- ggplot(aes(x = mpg, y = wt), data = mtcars) + geom_point()
p <- p + theme_void() + theme_transparent()
outfile <- tempfile(fileext=".png")
sticker(p, package="hexSticker", filename=outfile)

p <- ggplot(aes(x = mpg, y = wt), data = mtcars) + geom_point()

p <- p + theme_void() + theme_transparent()
outfile <- tempfile(fileext=".png")
sticker(p, package="hexSticker", filename=outfile)
Error in png_dev(..., res = dpi, units = "in") :
unused arguments (type = "cairo-png", antialias = "subpixel")

@justinmillar
Copy link

Hey @JobNmadu I was experiencing the same issue but update R seems to have resolved it (for me at least).

@spsanderson
Copy link

I am having the same exact issue:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

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

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

other attached packages:
[1] showtext_0.9-2   showtextdb_3.0   sysfonts_0.8.3   hexSticker_0.4.9

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6          pillar_1.6.1        compiler_4.0.2      BiocManager_1.30.16 tools_4.0.2        
 [6] jsonlite_1.7.2      lifecycle_1.0.0     tibble_3.1.2        gtable_0.3.0        ggimage_0.2.8      
[11] lattice_0.20-41     pkgconfig_2.0.3     rlang_0.4.11        DBI_1.1.1           ggplotify_0.0.7    
[16] rvcheck_0.1.8       magick_2.7.2        yaml_2.2.1          hexbin_1.28.2       dplyr_1.0.7        
[21] systemfonts_1.0.2   generics_0.1.0      vctrs_0.3.8         gridGraphics_0.5-1  grid_4.0.2         
[26] tidyselect_1.1.1    glue_1.4.2          R6_2.5.0            textshaping_0.3.5   fansi_0.5.0        
[31] ggplot2_3.3.4       purrr_0.3.4         magrittr_2.0.1      scales_1.1.1        ellipsis_0.3.2     
[36] assertthat_0.2.1    colorspace_2.0-1    ragg_1.1.3          utf8_1.2.1          munsell_0.5.0      
[41] crayon_1.4.1 

My code:

library(hexSticker)
library(showtext)

imgurl <- system.file("figures/healthyr-ai.png", package = "healthyR.ai")
sticker(
    imgurl
    , package = "healthyR.ai"
    , p_size=20, s_x=1, s_y=.75, s_width=.6,
    , filename = "C:/Users/Steve/Desktop/imgfile.png"
)

Error Message:

> library(hexSticker)

> library(showtext)

> imgurl <- system.file("figures/healthyr-ai.png", package = "healthyR.ai")

> sticker(
+     imgurl
+     , package = "healthyR.ai"
+     , p_size=20, s_x=1, s_y=.75, s_width=.6,
+     , filename = "C:/Users/Steve/Desktop/imgf ..." ... [TRUNCATED] 
Error in png_dev(..., res = dpi, units = "in") : 
  unused arguments (type = "cairo-png", antialias = "subpixel")
> 

@JobNmadu
Copy link
Author

I am still having the issue. Can there be help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants