I'm trying to plot some cities stored in my rda file naobrazokSR.rda
on a map from GADM
while having a background of the map in color #2C3E4F
. Without using the coord_map()
this works as intended but looks deformed. After using the coord_map()
white bars appear on top and bottom. I'm trying to use the plot inside shiny application and I believe this can be solved by fixing the aspect ratio somehow, but I'm not sure how. Is there a way to change the whitebars to my color without adjusting the aspect ratio?
library(ggmap)
library(ggplot2)
SVK <- readRDS("D:\\Downloads\\SVK_adm1.rds")
alfa = 0.5
load("D:\\Downloads\\naobrazokSR.rda")
p <- ggplot() + geom_polygon(data=SVK, aes(long,lat,group=group))
p <- p + geom_path(data=SVK, aes(long,lat, group=group), color="white",size=0.1)
p <- p + geom_point(aes(x=pomoc$X1, y=pomoc$X2) , size=2,col = "red", alpha=alfa)
p <- p + theme(axis.line=element_blank(),axis.text.x=element_blank(),
axis.text.y=element_blank(),axis.ticks=element_blank(),
axis.title.x=element_blank(),
axis.title.y=element_blank(),legend.position="none",
panel.background=element_rect(fill = "#2C3E4F", colour = "#2C3E4F"),
panel.border=element_blank(),panel.grid.major=element_blank(),
panel.grid.minor=element_blank(),
plot.background= element_rect(fill = "#2C3E4F", colour = "#2C3E4F"))
p <- p + coord_map()
p