[R] issue overlaying a contour plot on map

Jatin Kala jatin.kala.jk at gmail.com
Fri Dec 9 09:02:30 CET 2016


Hi R-community,
I am able to do a contour plot, and a map separately, but having some 
issues overlaying them. The script and data is attached.
test_filled_contour_plot.png is the contour plot alone
test_ggmap.png is the map alone.
test_overaly.png is supposed to overaly the two, but as you can see, 
it's not happening for some reason.
Any suggestions?
Cheers,
Jatin

-------------- next part --------------
# Always delete everything first
rm(list = ls())
library(rgdal)
# load processed AERMOD outputs generated by read_AERMOD_save.R
load("ALL_HOURLY_NOX_Processed")
utmcoor<-SpatialPoints(cbind(x,y), proj4string=CRS("+proj=utm +zone=50 +ellps=WGS84 +south"))
longlatcoor<-spTransform(utmcoor,CRS("+proj=longlat"))
lon <-longlatcoor at coords[,1]
lat <-longlatcoor at coords[,2]
png("test_filled_countour_plot.png")
filled.contour(x=lon,y=lat,max_conc)
dev.off()
library(ggmap)
pngMAP_df = get_map(location = c(min(lon), min(lat), max(lon), max(lat)), source = "osm", zoom = 12,filename="test_ggmap")
ggmap(pngMAP_df) + filled.contour(x=lon,y=lat,max_conc)
ggsave("test_overlay.png")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_filled_countour_plot.png
Type: image/png
Size: 58183 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20161209/a646360a/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_ggmap.png
Type: image/png
Size: 1636781 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20161209/a646360a/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_overlay.png
Type: image/png
Size: 1865369 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20161209/a646360a/attachment-0005.png>


More information about the R-help mailing list