Plotting images while removing any that have overlap


So I have this really basic example of using geom_image. What I would like to achieve is to not plot those images which will have overlap in the graphic based on overlap in pixels between two images or more. Is there some way to perform this?

Is there maybe a way of converting said images into boxes or shapes and first see if there will be any overlap?

See my basic plot below:


# create a df

d <- data.frame(x = rnorm(10),
                y = rnorm(10),
                image = sample(c("",
                               size=10, replace = TRUE)
# plot2
ggplot(d, aes(x, y)) + geom_image(aes(image=image), size=.08)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.