我已经在PUBG地图的图像上绘制了点,如下所示:
然而,图像的下边缘低于0,
,上边缘超过8e+05
,与左边缘和右边缘相同。
如何修复代码以将图片调整为宽度:0
到8e+05
,身高:0 to 8e+05
?
miramar <- readJPEG("/Users/lucyzhang/Waterloo/stat 847/project/pubg/miramar.jpg")
deaths1 <- read.csv(header=T,"/Users/lucyzhang/Waterloo/stat 847/project/pubg/deaths/kill_match_stats_final_0.csv",sep=',',stringsAsFactors=F)
victims1 <- deaths1[,c("victim_position_x","victim_position_y")]
victims1 <- subset(victims1,victim_position_x>0,victim_position_y>0)
s_victims1 <- victims1[sample(nrow(victims1),10000),]
ggplot(s_victims1, aes(x=s_victims1$victim_position_x, y=s_victims1$victim_position_y)) +
annotation_custom(rasterGrob(miramar, width=unit(1,"npc"), height=unit(1,"npc")),xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf) +
geom_point(colour="red", alpha=0.5)