Help! I have a GPS x / y dataset for trees in a forest, and with these codes in a nice map in ggplot:
#ggmap! library(ggmap) library(mapproj) map <- get_map(location = 'Madagascar', zoom = 10) geocode("kianjavato")
However, no matter what types of code I'm trying, I canβt get an arrow pointing north or a scale bar to draw on my map! I have tried many solutions, some of which are as follows:
attempt to add scale
map.scale <- ggmap(new) + (ggmap, extent = "normal", maprange = FALSE) %+% sites.data + geom_point(aes(x = lon, y = lat, colour = colour)) + geom_text(aes(x = lon, y = lat, label = label), hjust = 0, vjust = 0.5, size = 8/ptspermm) + geom_segment(data = sbar, aes(x = lon.start, xend = lon.end, y = lat.start, yend = lat.end)) + geom_text(data = sbar, aes(x = (lon.start + lon.end)/2, y = lat.start + 0.025*(bb$ur.lat - bb$ll.lat), label = paste(format(distance, digits = 4, nsmall = 2),'km')), hjust = 0.5, vjust = 0, size = 8/ptspermm) + coord_map(projection="mercator", xlim=c(bb$ll.lon, bb$ur.lon), ylim=c(bb$ll.lat, bb$ur.lat)) #library(SDMTools) #Scalebar(x=47.868,y=-21.375,distance=100,unit='m') #show values in meters #Error in map.scale(x = 50, y = -22) : argument "len" is missing, with no default map.scale(x=47.868, y=-21.375, ratio=FALSE, relwidth=0.2) #Error in map.scale(x = 47.868, y = -21.375, ratio = FALSE, relwidth = 0.2) : unused argument(s) (ratio = FALSE, relwidth = 0.2) map.scale(x=47.868, y=-21.375) #Error in map.scale(x = 47.868, y = -21.375) : argument "len" is missing, with no default
I need both the north arrow and the scale, but not a conspiracy! Why?