Closed dmongin closed 2 years ago
The image exists
> logo_filename
[1] "C:/Users/denis/Documents/R/win-library/4.1/png/img/Rlogo.png"
and indeed C:\Users\denis\AppData\Local\Temp\RtmpmGhtJA\filef8074d476d2.png
does not exist. I do not understand why magick is trying to get an image that does not exist. I tried running R as admin, it did not solve the pb either.
pattern_type
seems to reliably choke on CRAN/Rhub Windows and OSX machines but seems to work fine on Linux and Solaris machines. I suspect this is some subtle upstream magick bug that only affects certain platforms (and/or only certain magick versions?). It isn't something I've been able to reproduce locally on my Linux laptop (where it works fine) but I have been able to reproduce indirectly via R-builder/Rhub checks on relevant platforms.pattern_type
's that aren't "tile"It would be great if someone who has an affected platform (unfortunately can't reproduce this on mine) can extract a minimal reproducible example (cutting out {ggpattern}) and submit it upstream to {magick} (who in turn might need to pass it to the magick project) so this could be fixed.
It would be great if someone who has an affected platform (unfortunately can't reproduce this on mine) can extract a minimal reproducible example (cutting out {ggpattern}) and submit it upstream to {magick} (who in turn might need to pass it to the magick project) so this could be fixed.
I have the same issue when running the exemplary code
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# filenames of images
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
logo_filename <- system.file("img", "Rlogo.png" , package="png")
magpie_filename <- system.file("img", "magpie.jpg", package="ggpattern")
bug_filename <- system.file("img", "bug.jpg" , package="ggpattern")
seamless1 <- system.file("img", "seamless1.jpg" , package="ggpattern")
seamless2 <- system.file("img", "seamless2.jpg" , package="ggpattern")
seamless3 <- system.file("img", "seamless3.jpg" , package="ggpattern")
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Plotting data
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
df1 <- data.frame(
trt = c("a", "b", "c"),
outcome = c(2.3, 1.9, 3.2),
gravity = c('South', 'North', 'West'),
filltype = c('squish', 'fit' , 'expand'),
scale = c(1, 2, 0.5),
filename = c(logo_filename, magpie_filename, bug_filename),
stringsAsFactors = FALSE
)
ggplot(df1, aes(trt, outcome)) +
geom_col_pattern(
aes(
fill = trt,
pattern_gravity = I(gravity),
pattern_scale = I(scale)
),
pattern = 'image',
pattern_filename = logo_filename,
pattern_type = 'none',
colour = 'black'
)
What do you mean precisely by submitting an example upstream, cutting out {ggpattern}? I would not know how to reproduce this error outside of the ggpattern context.
{ggpattern} calls {gridpattern} calls {magick}. There should be a sequence of underlying R commands that reproduce this error that only require {magick} and not {ggpattern} nor {gridpattern}. The {magick} maintainer is much more likely to solve the issue if we give them a minimal, reproducible example. They probably are not going to disentangle the {ggpattern} -> {gridpattern} -> {magick} code themselves... Figuring out that underlying sequence would involve reading {gridpattern} code and writing {magick} code:
1) Reproduce the error using just gridpattern::grid.pattern_image()
instead of {ggpattern}
2) Re-write relevant grid.pattern_image()
logic into minimal, reproducible {magick} code
Note that example works fine on our personal machines, only a subset of users are affected and we're not sure why. Hard to fix a bug we can't directly see ourselves.
type = "tile"
we were calling the system binary convert
which on Linux is usually imagemagick
but on Windows is usually something else so it chokes (with an unhelpful message).{gridpattern}
has been updated so it first tries to use convert
and if it chokes it instead falls back on using magick::image_blank()
to tile the image. This sometimes works but unfortunately this usage of magick::image_blank()
doesn't seem to work right consistently so although it should no longer raise an error on Windows you may see glitchy output (https://github.com/ropensci/magick/issues/344).
When trying to reproduce a vignette example:
I get the following error:
I updated magick, but it did not solve the pb.
Here is my session info: