0

I want to create a map kind of like this:

I interpolated the data and then plotted it using filled.contour()

As you can see, the map is not plotting correctly. I need to find a way to convert the output back into latitude and longitude so that the map will plot correctly. How do I do this?

I checked out this forum: Plotting interpolated data on map but it doesn't answer my question.

enter image description here

Code for map:

df <-read.table("Petra_phytoplankton+POM_xydata_minusNAs_noduplicates.txt",header=T)
attach(df)
names(df)
fld <- with(df, interp(x = longitude, y = latitude, z = d13C))

filled.contour.ungeoreferenced<-(filled.contour(x = fld$x,
                           y = fld$y,
                           z = fld$z,
                           color.palette =
                             colorRampPalette(c("blue", "green","yellow","orange","red")),
                           xlab = "Longitude",
                           ylab = "Latitude",
                           key.title = title(main = "d13C", cex.main = 1)))

map(add=TRUE, fill=TRUE)

FYI here is a snippet of my dataset:

latitude    longitude   d13C
-65 -70 -27.7
-61 150 -32.2
-61 150 -28.3
-60 116 -26.8
-60 116 -24.7
-47 38  -24.8
-38 150 -20.5
19  -65.7   -19.9
19  -65.5   -18.5
18  -60.7   -20
18  -58.5   -18.2
18  -57.8   -19
17  -55.4   -18.6
17  -50.8   -18
17  -47.1   -18.3
17  -45.5   -19.4
16  -43.3   -17.9
15  -40.7   -18.5
14  -39.3   -19.9
12  -36.7   -19.9
12  -36.2   -19.9
11  -34.4   -19.2
10  -32 -18.5
9   -30.3   -19.3
8   -29.2   -19.4
7   -26.6   -18.2
7   -25.5   -19.3
6   23.9    -20
3   -21.3   -20.4
Community
  • 1
  • 1
Roseanna
  • 133
  • 1
  • 1
  • 7
  • 1
    Or you can combine `raster` and [`rasterVis`](http://oscarperpinan.github.io/rastervis/) packages. –  Feb 04 '15 at 04:54
  • @Pascal ok thanks - but I'm really new to mapping in R, so could you please tell me how I use these, or point to a help forum? Very much appreciated! – Roseanna Feb 04 '15 at 05:02
  • You should start with the [Introduction to the raster package](http://cran.r-project.org/web/packages/raster/vignettes/Raster.pdf) and with the website dedicated to the [rasterVis package](http://oscarperpinan.github.io/rastervis/). –  Feb 04 '15 at 05:20
  • 1
    This looks pretty similar to http://stackoverflow.com/questions/28290903/r-mapping-filled-contour-georeferencing-interpolation – IRTFM Feb 04 '15 at 06:31
  • @BondedDust yes it is but no one answered it so I thought maybe I should try rephrasing it to make it better. I will delete the old one soon :) – Roseanna Feb 04 '15 at 18:22

0 Answers0