title: Creating a filled contour plot using data in lists
body: <p>I have a data set that consists of 3 columns in a .csv file. The first 2 columns are map co-ordinates and the third is the percentage of zinc found in a borehole at the corresponding map co-ordinates. I would like to create a contour map to show the Zn concentration changes with distance. All of the examples of code I have been able to find use data in the form of a matrix, whereas mine are in lists. I have tried several different ways of plotting this which I have shown underneath, the majority of methods give me error messages along the lines of "object x not found" which I think is to do with the layout of my data. Does anyone know how to do this? I have added a similar data set to mine below. Thanks for any help in advance.
  Holly</p>
  
  <p>Data set:</p>
  
  <pre><code>Statsrep &lt;- structure(list(X = c(156000L, 156010L, 156421L, 156450L, 156500L, 156700L, 158420L, 158646L, 158970L, 159050L, 159050L, 159130L, 159155L), Y = c(143630, 143980, 147260, 145000, 146000, 142800, 146700, 145207, 147170, 145200, 144800, 147815, 145890), Zn = c(2, 8, 4, 0, 3, 0, 2, 7, 12, 0, 4, 19, 0)), .Names = c("X", "Y", "Zn"), row.names = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L), class = "data.frame")
  Statsrep
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>library(ggplot2)
  Grade &lt;- read.csv(file="filename.csv", header=TRUE, sep=",")
  ggplot(Grade, aes(x$x="X", y$y="Y", z$z="Zn")) +
  stat_contour()
  
  library(lattice)
  Grade &lt;- read.csv(file="filename.csv", header=TRUE, sep=",")
  levelplot(Grade ~x*y, data = Zn,
  xlab = "Eastings", ylab = "Northings",
  col.regions = terrain.colours)
  
  Grade &lt;- read.csv(file="filename.csv", header=TRUE, sep=",")
  x$x &lt;- X
  y$y &lt;- Y
  z$z &lt;- Zn
  filled.contour(x$x, y$y, z$z, color = terrain.colours,
  xlab = "Eastings", ylab = "Northings"),
  plot.axes = {axis(1, seq(156000, 165000, by=1000)); axis(2, seq(142000, 150000, by=1000))},
  key.title = title(main="Zn content\n(percent)"),
  key.axes= axis(4, seq(0, 20, by = 2)))
  </code></pre>