In R, I would like to use ggplot2 to produce nice output graphics (maps) for my gridded data.
The problem is that the data are on a rotated latitude-longitude grid for which I have either
- the coordinates of the rotated (but regular) grid and the coordinates of the north pole or
- the coordinates or the coordinates of the grid points as real world latitude-longitude coordinates (as an irregular grid).
Everything I tried left me with an empty map with no data on the plot.
Does anyone have a clue how to get this working with ggplot2?
EDIT:
Sorry for not providing data and an example before:
The real lat-lon coordinates for my grid can be downloaded from here (11MB): https://www.dropbox.com/s/ck6v7fjufe7wdp8/latlon.Rdata?dl=0
Example data for these coordinates can be found here (400KB): https://www.dropbox.com/s/psleu6yvb3pzw81/example.Rdata?dl=0
This code is how far I got with these data using ggplot:
load("example.Rdata")
load("latlon.Rdata")
data<-data.frame(values=c(values),lon=c(lons),lat=c(lats))
coord = data.frame(data$lon,data$lat)
ggplot(aes(x = data$lon, y = data$lat, fill = data$values), data = data) + geom_tile() + geom_path(data = coord)
I hope that is sufficient as a minimum working example.