Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Using the map function along with the image function for geospatial data in R

$
0
0

I am trying to plot geospatial sea surface temperature correlation data on the world map (only Northern hemisphere). I am using the image function (plot correlation data) along with the map function (plot coastlines). On their own, I get them to work. My problem is I am not able to overlay the map on the image, the map just shows up as a small point at the left corner at the bottom of the plot. The packages I am using are graphics for the image function and maps for the map function.


Generate test data

cor_nao_map = array(data = NA, dim = c(384,96))
for(i in 1:384) {
  cor_nao_map[i, ] = runif(96)  
} 

Plot

image(x = 1:384, y = 1:96, z = cor_nao_map, col = diverge_hcl(100), 
      zlim = c(-0.43,0.43), xlab = "Longitude in °", ylab = "Latitude in °N")  

map('world', projection = "gilbert", add = T)

Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>