my github

CO2 Stream

Jabs Geothermal

Simple graphing in R

Note: This assumes a basic working knowledge of R (I'm using R-Studio), including how to download packages, such as ggplot2. If you need a primer on R, I'd highly recommend this one.


The ZERT Site at Montana State University, in Bozeman, has studied the fate of CO2 injected into a shallow pipe in an agricultural field for the last 8 years. The pipe is ~70m long, and buried ~1m under the surface of an unirrigated hay field. Injection events vary in length and volume, but in 2008, ~0.3 Mg CO2/d were injected. Most of this CO2 bubbles up through the pipe, bubbles through the shallow water table, leaks through the soil and into the atmosphere, where ZERT scientists have tested methods to detect leakage from CO2 injection sites.[Spangler, et al., 2010 in Environmental Earth Sciences]

(pssst: click the "earth view" in the bottom left corner of the map and you can see the site!)

As soil scientists we wanted to know if it any of the leaked CO2 was taken up by plants, then turned into soil organic matter (by decay or root exudate). This is made possible by the fact that the carbon isotopes in the injected CO2 are different than those in naturally occuring CO2. The relative composition of C13 and C12 in ambient air, δ13C, is around -10 to -13‰, but the injected CO2 has a δ13C of -52‰. So if injected CO2 has been cycled back into the ground, the soil around the injection hot-spot(where the most leakage was measured), should have a depleted carbon isotope signature relative to the normal soils.

We sampled ZERT soils in Fall 2014 (~1 month after injection) via push corer (1.58 x 30.0 cm) at locations 1, 2.5, 5, 10, and 50 m northwest and southeast of the 0,0 coordinate of the pipe. Six samples were collected from each core at 5 cm increments, dried, sieved to less than 2 mm, and ground in a ball mill. In December, 2014, triplicate samples (and blanks) from the 1- and 2.5-m cores (n=72) were sent to UC Davis Stable Isotope Facility(UCD-SIF) for δ13C analysis.

Fig 1

This is a simple schematic of our transect and sampling sites.

The following is the process I used to graph the results we retrieved from UCD-SIF.

Step 1: Organize the Data!

I copied and pasted the data from UCD into a new .csv file. Its possible to do the averages and standard errors in R, but I find it easier in excel.

Excel file

Here is the original excel file.

CSV file

And here is the .csv file. Notice how I added columns to define transect side, distance, depth, and core. These are all important for making nice looking graphs!

Step 2: Make some plots!

Ah! If only it was that easy... Luckily, I'm providing the source code for you! Before we dive in to the r-code, though, I want to emphasize how important it is to plan your plots before you make them. As the researcher, it is easy to get focused on the nitty gritty of plotting and lose sight of the whole reason why we are making plots, which is to share information. Data visualization is as much, if not moreso, art than science, so take some time to sketch out graphs, bounce your ideas off others, and do a little background research on how to make nice plots.

In this instance, I've already made some pen and paper sketches of what my graphs should look like, and those are hugely helpful in terms of making actual plots.

The outline of the code is this: .csv file -> dataframe -> x-axis = carbon values, y-axis = depth -> facet plot based on distance -> color based on transect side -> add error bars and labels.

This gives us:

d13C TC

Ok, so maybe not ready for publication, but its a good start! As you can see, our δ13C isn't exactly that depleted (-28 @ 1m off the pipe, compared to -15 to -20 in previous experiments [Shim, et al., 2009 in Oecologia]), but we haven't yet analysed the samples from 50m NW/SE sites yet. That means we don't know exactly what the δ13C is in unaltered soils, so stay tuned.