ggimage

How to use an image as a legend key glyph?

做~自己de王妃 提交于 2020-05-17 05:26:11
问题 I am plotting a scatterplot in ggplot with icons and I am stuck with producing a legend using the icons. THere is a function in the ggimage documentation called "draw_key_image" but I don't really understand how to use it or the required arguments. The documentation says "data = A single row data frame containing the scaled aesthetics to display in this key" but this does not help me at all! https://www.rdocumentation.org/packages/ggimage/versions/0.2.7/topics/draw_key ##Hopefully

Is it possible to add custom shapes ( from png) to ggplot legend?

若如初见. 提交于 2020-04-30 06:29:39
问题 I was wondering whether it is possible to add shapes to the legend for ggimage() . I found similar questions, but they either have 1) same picture with a different color in legend, or 2) same picture different colors. I used this link to add images to the legend that have color, but i can't figure out how to edit it so that image will be different. I tried this, but I am not advance enough to adjust the code to fit my case d <- data.frame(x = rnorm(10), y = rnorm(10), image = sample(c("https:

How to remove background of images with the magick package?

瘦欲@ 提交于 2019-12-24 08:35:34
问题 Is it possible to remove the background of images with the magick package? I know how to use edge detection with Gimp/Inkscape to crop out silhouettes; however, I'm looking to automate the process for a large batch of images with R . My ultimate goal is to use the ggimage package to plot these images as x,y coordinates but the background of these images is currently overlapping the plot (the dog compared to fink) library("ggplot2") library("ggimage") set.seed(2017-02-21) d <- data.frame(x =

Can geom_image() from the ggimage package be made to preserve the image aspect ratio?

南笙酒味 提交于 2019-12-02 05:15:33
问题 When researching this answer, I tried to draw the image strip via geom_image() from the ggimage package but couldn't get it to work. geom_image() modifies the images aspect ratios, and I don't know how to prevent it from doing it (or whether that is even possible). It's also not clear to me in what units size is measured. From how the code behaves, maybe it's in npc coordinates running from 0 to 1, regardless of the ggplot2 coordinate system? Here is the code I used: require(ggimage) df_img <

Can geom_image() from the ggimage package be made to preserve the image aspect ratio?

十年热恋 提交于 2019-12-02 00:03:40
When researching this answer , I tried to draw the image strip via geom_image() from the ggimage package but couldn't get it to work. geom_image() modifies the images aspect ratios, and I don't know how to prevent it from doing it (or whether that is even possible). It's also not clear to me in what units size is measured. From how the code behaves, maybe it's in npc coordinates running from 0 to 1, regardless of the ggplot2 coordinate system? Here is the code I used: require(ggimage) df_img <- data.frame(phase = c("Interphase", "Prophase", "Metaphase", "Anaphase", "Telophase"), image = c(