I'm trying to plot a U-Pb isochron, which is basically an xy plot, with an error ellipses around each datapoint to indicate the precision of that data point. Here's an example of what I'm trying to achieve, the only difference being that I have a lot more data points:
I have symmetrical + and - errors for each data point in x and y space that I would like to use to dictate the shape of the error ellipse.
Below is the code that I have written so far. This plots up my data, but instead of error ellipses I currently have errorbars.
# Select data file.
fname<-file.choose()
# Rename imported data file.
upbiso <- read.table(file=fname, header= TRUE)
# Attaches data file as default data source.
attach(upbiso)
# Reads and display column headers in console.
names(upbiso)
# Sets margins around plot.
par(mar=c(5,5,4,2))
# Plots 238U/206Pb vs 207Pb/206Pb with superscript notation for isotopic masses, xlim and ylim sets min and max limit for axes, las rotates y axis labels, cex.lab increases the size of the axis labels.
plot(UPb, PbPb, xlab = expression({}^238*"U/"*{}^206*"Pb"), ylab = expression({}^207*"Pb/"*{}^206*"Pb"), xlim = c(0,2500),ylim = c(0, 1), las=1, cex.lab = 1.5)
# Opens Oceanographic package to run errorbars function and runs 1 sigma percent error bars for x-y co-ordinates.
library(oce)
errorbars(UPb,PbPb,UPbErrP,PbPbErrP, percent=T)
How would I go about replacing the errorbars with error ellipses?
Here's a Google docs link to my data which is in .txt format.
https://docs.google.com/file/d/0B75P9iT4wwlTNUpQand2WVRWV2s/edit?usp=sharing
Columns are UPb
, UPbErrP
(error on UPb at 1 sigma %), UPbErrAbs
(absolute error on UPb), and then the same again for the PbPb
data.
If you need me to clarify anything just let me know and I'll do my best