0

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.

Jan
  • 1
  • 2
  • 6
    Please show what you have tried and some data to make a reproducible example – Richard Telford Feb 03 '17 at 11:27
  • 2
    Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – Axeman Feb 03 '17 at 12:17
  • Sorry for not having provided a minimum example. I added this and links to the data necessary to tun the example. – Jan Feb 04 '17 at 23:22

0 Answers0