Hello, I am able to create 2 png images (maps) in leaflet and call using plot2 and plot3 having assigned the images in the working directory to these objects. I had to use leaflet to do this due to issues I have had with adding basemaps in other packages such as ggplot and tmap.
I can put these images side by side using R Markdown:
knitr::include_graphics(c(plot3, plot2))
I want to insert a sliver of white space between the maps so it is clear they are separate. How can I do this? I have tried using the following so I can call it in R Markdown but I get a blank png image:
png(filename = "context-and-catchment-map.png", width = 2500, height = 1600, res = 300)
op1 <- par(mfrow = c(1,2))
op2 <- par(mar = c(5,4,5,2)+0.1)
m <- leaflet(x_G84041) %>% addTiles() %>% addPolygons(fillColor = ~pal(Patients),
fillOpacity = 0.7, color = "#000000", weight = 1, opacity = 1) %>%
addAwesomeMarkers(lng = coord$long, lat = coord$lat, icon = icon.fa) %>%
addLegend(pal = pal, values = ~Patients)
par(op2)
op3 <- par(mar = c(5,5,4,2)+0.1)
n <- leaflet(ccg_br) %>% addTiles() %>% addPolygons(color = "#000000", weight = 2, fillOpacity = 0.1) %>%
addPolygons(data = x_G84041, color = "#000000", weight = 1, fillColor = "#2E8B57", fillOpacity = 1) %>%
addAwesomeMarkers(lng = coord$long, lat = coord$lat)
par(op3)
par(op1)
dev.off()
Any help much appreciated.
Thanks