Vikas Rawal
unread,Apr 10, 2015, 3:41:17 AM4/10/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ggp...@googlegroups.com
I would like to use Gall-Peters projection for a map I am making. But coord_map("gall”) in the code below does not seem to do anything. I have also tried coord_map(project="gall”), coord_map(projection="gall”).
Would appreciate help.
Vikas
--------
library(mapproj)
library(ggplot2)
readShapePoly(fn="indiadistrictmap/2011_Dist")->indiamap
read.table("data/indialatrines2.csv",sep="|",header=T)->latrines
subset(latrines,TRU=="Total")->latrines
names(latrines)[3]<-"censuscode"
indiamap <- fortify(indiamap, region = "censuscode")
m1<-ggplot()
m1+geom_path(data=indiamap,aes(x=long, y=lat, group=group),colour='grey',size = 0.1)->m1
m1<-m1+geom_map(data = latrines, aes(map_id = censuscode, fill = Unimproved.sanitation),map = indiamap)+ expand_limits(x = indiamap$long, y = indiamap$lat)
m1+coord_map("gall")->m1
m1+scale_fill_gradient2(low = muted("blue"), mid = "white", midpoint = 50, high = muted("red"), limits = c(0, 100))+coord_map()->m1
m1+theme(legend.justification=c(1,0), legend.position=c(1,0))+theme(legend.title=element_blank())->m1
m1+theme(axis.title.x = element_blank())+theme(axis.title.y = element_blank())->m1
m1+theme(plot.background = element_rect(fill="grey83", colour=NA),legend.background= element_rect(fill="grey90", colour=NA))->m1
m1+ggtitle("Lack of improved sanitation")->m1