R plotting over custom image but image keeps resizing

32 views Asked by At

I've been experimenting using riot's api and wanted to plot champion kills/death onto the map of the rift. But the map doesn't seem to fill the plot area so the points don't match the map.

Below is the code I was using to make the plot and its output. Any suggestions on how to fix?

library(ggplot2)
library(jpeg)
library(grid)

path="mypath"
img=readJPEG(path)
img=rasterGrob(img,interpolate=TRUE)
ggplot(data=jk,aes(x=x,y=y))+coord_cartesian(xlim=c(-200,15000),ylim=c(-200,15000))+
annotation_custom(img, xmin=-Inf, xmax=Inf, ymin=-Inf,ymax=Inf)+ geom_point(color="red")+facet_wrap(vars(role))

enter image description here

0

There are 0 answers