Hello R-users,

I am trying to do an image plot where I have been given latitudes,
longitudes and the values at the corresponding locations. A sample of the
data is given as follows:

   values=c(0,1,0,0,0,0,2,2,0,0)
lat=c(29.6660,29.6756,29.3492,29.2654,29.2827,29.4070,35.3510,35.6590,35.7587,38.2794)
long=c(-95.8121,-95.6565,-95.5771,-95.4400,-95.4356,-95.0294,-81.7940,-81.4850,-81.3777,-86.9999)


I used the following command to generate the image plot along with an U.S.
map:

library(maps)
image(values,x=sort(long),y=sort(lat))
map("state",add=T)

But every time I run the code I get the following error:

Error in image.default(values,x=sort(long),y=sort(lat),

increasing 'x' and 'y' values expected

Even though I sort the latitude and longitude in increasing order, I am
getting this error. Any help is greatly appreciated.

Thanks in advance,

Cassie.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to