Try this (notice the boundingbox) :
library(ggmap)
#> Loading required package: ggplot2
#> Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
#> Please cite ggmap if you use it! See citation("ggmap") for details.
library(osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
traps <- data.frame(
name=c("Kim Ma","An Khanh","Gia Quat", "Ngoc Ha", "Cu Khoi N", "Cu Khoi S"),
longitude=c(105.818147,105.732711,105.879748,105.8265118,105.9067497,105.9067648),
latitude=c(21.031584,21.008828,21.055393,21.0399774,21.0083294,21.0081745),
stringsAsFactors=F)
#location <- c(106,20.5,105.6,21.1) # if this is supposed to be bounding box
location <- c(105.6,20.9,106,21.1) # than specify it like this
Hanoi <- get_map(location = location, source = "osm", zoom = 12)
#> Source : http://tile.stamen.com/terrain/12/3249/1802.png
#> Source : http://tile.stamen.com/terrain/12/3250/1802.png
#> removed 14 similar lines HanOostdijk
#> Source : http://tile.stamen.com/terrain/12/3253/1804.png
#> Source : http://tile.stamen.com/terrain/12/3254/1804.png
Hanoimap <- ggmap(Hanoi)
Hanoimap <- Hanoimap + geom_point(data=traps, aes(x = longitude, y = latitude), size = 5)
Hanoimap <- Hanoimap + geom_text(data=traps,mapping=aes(x = longitude+.001, y = latitude-.001,label = name))
print(Hanoimap)
Created on 2021-07-21 by the reprex package (v2.0.0)