Dear all, I have a data set which has latitude, longitude (not in increasing order) and observed precipitation corresponding to those locations. I am using image.plot command for that. But I want to overlay a map of US on that plot. I know we can use map('usa') to draw it, but I dont know how can I overlay it on the plot of the precipitation data. Can anyone please help me with it? Thanks in advance. Cassie. [[alternative HTML version deleted]]
A First guess would be to have a look at ?map and change the 'add' argument to TRUE. This would overlay the map to the image plot that you produced before. It may be that you need to mess around with different projections etc. but I can not give you any advice on that without digging deep into the documentation.... HTH Jannis On 02/14/2011 03:14 AM, cassie jones wrote:> Dear all, > > I have a data set which has latitude, longitude (not in increasing order) > and observed precipitation corresponding to those locations. I am using > image.plot command for that. But I want to overlay a map of US on that plot. > I know we can use map('usa') to draw it, but I dont know how can I overlay > it on the plot of the precipitation data. Can anyone please help me with it? > > > Thanks in advance. > > Cassie. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
You may want to use the ggplot2 package for this (see ?coord_map), it can combine maps and other plots and does a lot of the thinking about scaling and projections for you. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of cassie jones > Sent: Sunday, February 13, 2011 7:15 PM > To: r-help at r-project.org > Subject: [R] how to overlay a map of US on image plot > > Dear all, > > I have a data set which has latitude, longitude (not in increasing > order) > and observed precipitation corresponding to those locations. I am using > image.plot command for that. But I want to overlay a map of US on that > plot. > I know we can use map('usa') to draw it, but I dont know how can I > overlay > it on the plot of the precipitation data. Can anyone please help me > with it? > > > Thanks in advance. > > Cassie. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.