I have a data set consisting of 3 columns in a CSV file. The first 2 columns are the coordinates of the map, and the third is the percentage of zinc found in the wellbore in the corresponding coordinates of the map. I would like to create a contour map to show changes in Zn concentration with distance. All the code examples that I could find use the data in matrix form, and mine in the lists. I tried several different ways of constructing this, which I showed under it, most of the methods give me error messages along the lines "object x not found", which, I believe, concerns the layout of my data. Does anyone know how to do this? I have added a similar dataset below. Thanks for any help in advance. Holly
Data set:
Statsrep <- 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
the code:
library(ggplot2)
Grade <- 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 <- read.csv(file="filename.csv", header=TRUE, sep=",")
levelplot(Grade ~x*y, data = Zn,
xlab = "Eastings", ylab = "Northings",
col.regions = terrain.colours)
Grade <- read.csv(file="filename.csv", header=TRUE, sep=",")
x$x <- X
y$y <- Y
z$z <- 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)))