I have a map with some points across it that were created with geom_point
. They are in the exact location and color I need them to be, but I am trying to change the shape to a silhouette I imported from phylopic. Here is some sample data for the code
#Dataframe for the points
individual_dets = data.frame(longitude= seq(-64.5,-62.4,0.1),
latitude= seq(42.7,44.8,0.1),
year = sample(c(2016, 2017, 2018), 22, replace = T),
Zone = sample(c(1:4), 22, replace = T),
month = sample(month.abb, 22, replace = T))
Below is the code for my imported phylopic silhouette, and my code for the map with the points on it
library(rphylopic)
library(RCurl)
library(png)
library(mapdata)
#Import phylopic
rayurl = "http://phylopic.org/assets/images/submissions/a3b3e80c-22f2-4b8f-a3ac-42fe1583e0be.thumb.png"
raylogo = readPNG(getURLContent(rayurl))
#Importing the map
canada = map_data("worldHires", "Canada")
#The Map
ggplot() +
geom_polygon(data = canada,
aes(x=long, y=lat, group=group),
colour="grey50", fill = 'grey55')+
#Coordinates I'm interested in looking at
coord_sf(xlim=c(-64.5,-62.8), ylim=c(42.7,45)) +
geom_point(data = individual_dets,
aes(x = longitude,
y = latitude,
color = as.factor(Zone)),
#fill = as.numeric(Zone)),
size = 5) +
scale_color_manual(values=c("#01579B", "#4FC3F7", "#ffa600", "#ff6361"),
name = "Zone")
Does anyone know how to take this saved silhouette and place it at the same coordinate and as the same color of my points?