I am to map a plot of an area and then plot points over it (given by Easting and Northing). However, I found out that there are certain mistakes in the data entered for Easting and Northing resulting in some outlying points, and
ggplot (which I am using) tends to reshape the map in order to fit the outlying points.
Is there any quick way to fix this issue? I do not know of any except to identify and correct the points manually. I am using shapefiles from the Ordnance survey.
Here is the screen-shot. The image does not appear to be skewed. However, upon comparison with other images, the differences become apparent.
The code I'm using is as follows.
countyRegion<- readShapePoly(file.choose()) norfolkCounty<- countyRegion[countyRegion$NAME=="Norfolk County",] #convert shape file into data that can be plotted on graph gpclibPermit() norfolk<- fortify(norfolkCounty,region="NAME") Norfolk<- merge(norfolk, norfolkCounty@data,by.x="id",by.y="NAME") #eit data jul2012<- read.table(file.choose(),header=TRUE,as.is=TRUE,blank.lines.skip=FALSE,sep=",") jul2012$Crime.type<- factor(jul2012$Crime.type) jul2012<- jul2012[jul2012$Crime.type!="",] jul2012$Crime.type<- factor(jul2012$Crime.type) levels(jul2012$Crime.type)<- c("Anti-social behaviour","Theft/burglary","Criminal damage/arson","Drugs","other crime","Theft/burglary","Public disorder and weapons","Theft/burglary","Vehicle crime","Violence and Sexual Offences") #plot jul12Map<- ggplot(data=Norfolk,aes(long,lat)) + geom_polygon() + geom_point(data=jul2012,aes(Easting,Northing,colour=as.factor(Crime.type)),alpha=0.6) + scale_colour_brewer(palette="Set1",name="Category") + theme_bw() + scale_x_continuous(breaks=0,labels="") + scale_y_continuous(breaks=0,labels="") + theme(axis.ticks=element_blank(),panel.grid.major=element_blank(),panel.grid.minor=element_blank())