Questions tagged [ggimage]

An R package aims to support image files and graphic objects visualization based on 'ggplot2' graphic system.

Resources:

  1. cran.r-project.org
  2. github
34 questions
7
votes
0 answers

Keep original image ratio in {ggimage}

I'm trying to use a non squared image in a {ggimage} layer but I can't seem to make the ratio fit the orignal image ratio. Documentation points to the asp argument but this doesn't seem to work. Here's an obviously non square image :…
Colin FAY
  • 4,849
  • 1
  • 12
  • 29
5
votes
2 answers

Use SVG images as symbols in gglot2

I would like to use vector graphics stored in external files (e.g. SVG) as my plotting symbols in a ggplot2 figure. e.g. following this example from the grImport vignette (Fig. 8) https://cran.r-project.org/web/packages/grImport/vignettes/import.pdf…
Mark Payne
  • 557
  • 5
  • 12
5
votes
0 answers

Google basemap and geom_sf aligned WITH custom geom_image symbols and annotation labels in R

I would like to use custom symbols and annotation on a geom_sf polygon layer that is placed on a google basemap. Initially, I had difficulty with the basemap and polygon lining up correctly So I used this Stack Overflow solution to fix it. Now the…
ErikaD
  • 51
  • 6
5
votes
2 answers

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

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…
Claus Wilke
  • 16,992
  • 7
  • 53
  • 104
5
votes
1 answer

Use ggplot to plot over an image with legend

I would like to map OHS incidents over a PNG of a hospital floorplan using ggplot2. I have tried reading this non-geographic map in as a ggimage. So far I have tried the following with the dataset (14462) observations that I have. Example…
monkeyshines
  • 1,058
  • 2
  • 8
  • 25
4
votes
1 answer

ggimage: Custom image from computer rather than from web

The following graph can be produced from the R code given below. The images used in the graph are fetched from website. I'm wondering how to use images from computer. library("ggplot2") library("ggimage") set.seed(2017-02-21) d <- data.frame(x =…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
3
votes
1 answer

How to use multiple colors with geom_image()

I'm having trouble figuring out how to highlight multiple colors with ggimage. It's clear how one can set different images to a single color (from vignette): library("ggplot2") library("ggimage") set.seed(2017-02-21) d <- data.frame(x =…
3
votes
1 answer

geom_image(): how to set image sizes individually

This question is related to Can geom_image() from the ggimage package be made to preserve the image aspect ratio? but in my application I want to make a scatterplot, using images scaled in proportion to their actual image sizes. The figure (done…
user101089
  • 3,756
  • 1
  • 26
  • 53
3
votes
1 answer

Offline plotting of map coordinates on static maps of Google

History: Extracted raster data from the static Google map png, loaded it on the R device through ggimage. library (png) library (ggmap) rasterArray <- readPNG ("My.png") x = c (40.702147,40.718217,40.711614) y = c…
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
2
votes
1 answer

Adding images to end of geom_line

I have a dataframe that consists of 5 vectors: name <- c("a", "a", "b", "b", "b") game <- c(1, 2, 1, 2, 3) pts <- c(3, 6, 1, 6, 7) cum_pts <- c(3, 9, 1, 7, 14) image <- (image1, image1, image2, image2, image2) df <- data.frame(name, game, pts,…
2
votes
1 answer

geom_node_image() - Images for nodes in ggraph

I am trying to use images (e.g. country flags) in a ggraph network. I was looking to use ggimage's geom_image, however I reckon that the function needs to be adapted to work with ggraph where we do not specify the x and y…
Martin
  • 1,141
  • 14
  • 24
2
votes
1 answer

How to evenly plot geom_text in R?

I am trying to create an infographic style plot in ggplot but am having a lot of trouble figuring out how to start. I want to plot counts of a variable (women) inside of an image, with the name of the country underneath. I figured this would need to…
Grace
  • 55
  • 5
2
votes
2 answers

How to add image to a ggplot

I wanted to add an image extracted from a webpage (LeBron_James assigned below) to the ggplot using ggimage package. How can i add it to the ggplot rscript below? GGplot_mean_performance <- FirstPick_Wage_Performance %>% ggplot(aes(x=Player,…
xiuxiu
  • 47
  • 4
2
votes
1 answer

How to use an image as a legend key glyph?

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.…
Jo_G
  • 23
  • 3
2
votes
1 answer

Where does ggimage::geom_icon icons come from

I'm trying to insert hockey pucks into my ggplot. On font awesome, I found a hockey puck icon. I was hoping that ggimage::geom_icon could import font awesome icons, but unfortunately it doesn't: library(ggimage) set.seed(2017-02-21) d <-…
user8248672
1
2 3