library(ggmap) basemap <- get_googlemap(zoom = 15, scale = 4,format="png8", maptype="terrain") ggmap(basemap) # OK switch_bg <- function(