0

I am working on a leaflet map for humanitarian purposes, therefore I need to use the OCHA icons for objects on my map. but I couldn't find any library to insert OCHA icons to the R environment. any solutions? thanks

1 Answer 1

0

See my example

library(png)
library(grid)
library(tidyverse)


g1 = readPNG("icons/Advocacy.png") %>% rasterGrob(interpolate=TRUE)
g2 = readPNG("icons/Add-document.png") %>% rasterGrob(interpolate=TRUE)

mi_counties <- map_data("county", "michigan") %>% 
  select(lon = long, lat, group, id = subregion)

ggplot(mi_counties, aes(lon, lat)) + 
  geom_point(size = .25, show.legend = FALSE) +
  annotation_custom(g1, xmin=-88, xmax=-88.5, ymin=45, ymax=45.5)+
  annotation_custom(g2, xmin=-84, xmax=-84.5, ymin=42, ymax=42.5)

enter image description here

I saved the OCHA icons in png format. There was a problem with the svg format.

Not the answer you're looking for? Browse other questions tagged or ask your own question.