KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to make a map with two legends denoting shape and colour ("Type" and "Org" in the example below), and have the legends inset. I can place the legends, but I would like them to be left justified so that their left edges line up. I can't make them anything other than centred with respect to each other: require(ggplot2) require(ggmap) require(grid) require(mapproj) data <- data.frame(Org=rep(c("ABCDEFG","HIJKLMNOP","QRSTUVWX"),4) , Type=rep(c("Y","Z"),6), Lat=runif(12,48,54.5) , Long=runif(12,-133.5,-122.5)) osmMap <- get_map(location=c(-134,47.5,-122,55), source = 'osm') points <- geom_jitter(data=data, aes(Long, Lat, shape=Type , colour=Org)) legend <- theme(legend.justification=c(0,0), legend.position=c(0,0) , legend.margin=unit(0,"lines"), legend.box="vertical" , legend.key.size=unit(1,"lines"), legend.text.align=0 , legend.title.align=0) ggmap(osmMap) + points + legend
Tags (comma-separated)
Save Edits
Cancel