I am trying to make a plot in R containing the average Pb isotope ratios(206Pb/207Pb and 208Pb/207Pb) from 2 sites (“control” and “activesite”). I want 4 error bars on each data point (site) showing the standard deviation. I already calculated the average and standard deviation in excel so instead of pasting all of my data I have just listed the averages as “avg206Pb207Pb” and standard deviations as “sd206Pb207Pb”. This code has previously run just fine on my other data but for some reason I am now getting 8 error bars for each data point. Additionally usually the error bars will have perpendicular lines at the end of them and these don’t. What am I missing here?
Code:
pbratiofourwayerror$site <- factor(pbratiofourwayerror$site, levels = c(“activesite”,”control”))
a<-ggplot(pbratiofourwayerror, aes(x=avg208Pb207Pb, y=avg206Pb207Pb))+ geom_point(aes(color=site, shape=site), size=5)+scale_shape_manual(values=c(15,19)) + xlab(expression(“”^208*”Pb”“/”^”207”Pb)) + ylab(expression(“”^206“Pb”“/”^”207″*Pb)) + theme_classic()+ geom_errorbarh(aes(xmax = avg208Pb207Pb + sd208Pb207Pb, xmin = avg208Pb207Pb – sd208Pb207Pb, color=site), height=0.25)+geom_errorbar(aes(ymin=avg206Pb207Pb-sd206Pb207Pb, ymax=avg206Pb207Pb+sd206Pb207Pb, color=site), width=0.25)
a
Megan Reaves is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.