Mercury Arcana

Here’s a little project I created to try out the free online graphic design package Canva. While it won’t replace a full-service tool like Illustrator, Canva makes it very easy to create attractive presentations, posters, and simple infographics. It’s definitely worth a try.

Has Your Country Ratified the Minamata Convention on Mercury?

This map shows the current status of ratifications of the Minamata Convention on Mercury. Although I update it frequently, check for the most recent status. The map also shows countries engaged in Minamata initial assessment (MIA) and artisanal and small-scale  gold mining national action plan (NAP) projects funded by the Global Environment Facility (GEF), along with the implementing agencies. Use the “Visible layers” function on the map to toggle between ratification status, MIAs, and NAPs. The full screen button, located below the zoom controls, is also useful.

Data on ratification and GEF project status from the Interim Secretariat of the Minamata Convention and UNEP. Country boundaries from Natural Earth. Mapping done in CartoDB using Robinson projection.

Two Ways to Map Global Mercury Emissions

I’ve been playing with an interesting dataset recently, and it got me thinking about challenges in effectively visualizing geospatial data. Specifically, how do you best display a continuous variable whose values span several orders of magnitude?

The dataset I’m working with comes from the Arctic Monitoring and Assessment Program. It’s a estimate of global anthropogenic emissions of mercury per 0.5 x 0.5 degree grid square. One important reason why AMAP generated these data (and how they did it is an interesting problem and the topic for another post) was to help atmospheric transport modelers who need to know where on earth emissions are coming from. But the data also allow for a nice visualization of global sources of mercury pollution that goes beyond simple maps showing emissions by country.

I’ll present two options here, and I’d love feedback on what works best. I think there are also trade-off depending on what the purpose of the visualization is (presentation vs. exploration) and the scale. Both are made on CartoDB. You can zoom, scroll, and click on a point to see the data. Check out the full-screen option which I think is pretty cool.

The first is perhaps the more flashy one. It uses yellow circles whose size are proportional to mercury emissions. There is a multiply effect so areas of overlap appear orange-red.

This one is a more traditional chloropleth approach using an orange-red scale to represent the magnitude of emissions over each grid square.

Some technical notes:

The dataset contains around 45,000 grid squares (areas with no anthropogenic emissions, like oceans, are no data) with mercury emissions ranging from about 10^-5 to 12,000 kg. That’s around 8 orders of magnitude. Some quick exploration of the data revealed that almost all the mercury emissions came from less than 10 percent of the model area.

global hg dist

Cumulative sum of mercury emissions (normalized to 1) as a function of magnitude of emissions in each cell. Almost all emissions are from cells with greater than 10 kg emissions. Note log scale on x axis.

Most areas have very small emissions, but a few have very high emissions. The data are like this because the emissions estimates are made using both point sources, “area” sources like artisanal mining, and population as a proxy for some general emissions. In any case, to facilitate visualization I  removed the very-low-emissions-value grid squares. The remaining ~5000 squares comprise ~93% of total emissions. These data still have a pareto-like distribution ranging almost three orders of magnitude, but they are easier much easier to display on a map.

global hg dist tail

Cumulative sum of mercury emissions (normalized to 1) as a function of magnitude of emissions in each cell. Cells with < 50 kg Hg removed. Note log scale on x axis.

Note that the maps display mercury emissions per square km for each cell, not total mercury emissions. That is because the areas of the 0.5 x 0.5 grid cells vary with longitude. Those closest to the equator are larger, closer to the poles are smaller. So it makes for a more accurate display to normalize by the cell area.

An important factor in the visual appearance of continuous data like these is where to choose the breaks separating data points into different colors or sizes. This is especially difficult with pareto or power law distributions. CartoDB has several built in options for binning data. After playing around with them I choose head/tail breaks, which seems to work well on this type of distribution. CartoDB also allows you to easily change the breaks manually with cartoCSS. It was a challenge to find a binning and color/size scheme that portrayed the data in the most accurate way, while also maintaining a clear and striking appearance.

Color on the chloropleth comes from colorbrewer.

For more information on the development on the emissions model, see this paper.

Mercury in Chlor-Alkali Plants Mapped with CartoDB

The other day I learned that now supports embeds of CartoDB maps. This is pretty cool, and it inspired me to finish up a little project that I’ve been tinkering with for a while, in order to try out the new feature.

By the way, CartoDB is a web mapping tool that I think is one of the best interfaces available for creating interactive maps. You can make great looking maps quickly and easily, but there is also enough functionality to do more advanced stuff, like mess around with the CSS code.

This map shows estimates of how much mercury is on site at chlor-alkali plants per country. It distinguishes between countries that ban the export of mercury and those that don’t. This is important because chlor-alkali plants often contain hundreds of tons of mercury. When the facilities close the mercury can enter the commodity market where it can be used in artisanal gold mining.

The size of the bubbles reflects how many tons of mercury are estimated to be in chlor-alkali facilities in each country. Scroll, zoom, hover, or click for more details. The data are from the UNEP Global Mercury Partnership chlor-alkali inventory.

Technical CartoDB note: In order to distinguish (by bubble color) countries with and without export bans, I made two layers from the data table. However, because each set had a different range of values, the scale for the bubble size was different for each color. To fix this I manually changed the bubble size distribution cutoffs in the CSS tab. Is there an easier solution that I am missing?

Oh yeah, this is how you do the embed.

Updated Global Mercury Pollution Viz and Graphics

One of the first posts on this blog was about using Tableau to visualize data on global emissions of mercury.  I’ve gotten suggestions from a few people and given the graphic a bit of a face lift. Click on the image to see the interactive viz:

Dashboard_1 (3)

Click for interactive graphic

I also used the same dataset to make some static graphics using ggplot2 and the ggthemes package. I’d love any input on how to improve the the look and feel of both these and the Tableau viz. I’ve always found picking good colors very challenging, so thoughts on the palettes are especially welcome.


The 8 industry sectors with the highest global mercury emissions. Data for 2010 from the 2013 UNEP Global Mercury Assessment.


Countries with the highest mercury emissions. Data for 2010 from the 2013 UNEP Global Mercury Assessment.

Another Way to Look at Mercury in Seafood

In the previous post, I used Tableau Public to create a visualization of the Seafood Hg Database. That graphic showed the mean mercury content and number of samples by seafood category. But there are several other dimensions in the database, including the year of the study and the particular species of seafood sampled. I couldn’t resist playing around with the data a little more, this time using the lattice package in R.

The plot below shows the mean mercury concentration (y-axis) in studies of the 12 seafood categories with the highest median mercury concentration. The x axis shows the date of the study. I’ve also plotted a trend line for each panel. This is a nice way to visualize the data, but I wouldn’t read too much into this plot. For one thing, many of the seafood categories contain multiple species, some of which are higher than others in mercury. Also, this plot does not account for the geographical region where the fish were sampled.

We can tease a little more from the dataset by looking at the individual species within a seafood category. Here is a plot of the six tuna species with the greatest number of studies. The larger species, like bluefin, seem have higher mercury contents than the smaller ones, like skipjack. One curious feature of the dataset is also visible here: there were very few studies of mercury in seafood in the 1980s.

How Much Mercury is in Your Favorite Seafood?

I’ve written before about mercury emissions, mercury as a commodity, and mercury use in artisanal mining. But the reason we pay so much attention to mercury is because of its human health impacts, and these are primarily caused by eating contaminated seafood.

Different types of seafood have different amounts of mercury. Because mercury is bioaccumulative, organisms that are higher on the food chain tend to have greater mercury concentrations. Of course, the particular environment where the organism lives also plays a big part.

Scientists have been interested in the mercury content of seafood for decades. Recently, a group of researchers undertook the herculean task of aggregating data from almost 300 studies. The result is the Seafood Hg Database (and an accompanying paper). The database contains the mean mercury concentrations measured in each study for one or more of 62 seafood categories. Overall, the database represents over 62,000 individual measurements from around the world.

It’s a great dataset to play around with and experiment with visualizations. In the graphic below, I plot mercury concentrations for a subset of common seafood types. Each circle represents the mean concentration measured in one study, and the size of the circle is proportional to the number of samples in that study. I’ve overlaid box plots for each seafood category that show the median of all the means, as well as first and third quartiles (whiskers go to 1.5x the IQR).

I think this is much more instructive than simply plotting the grand mean (average of all the study averages) for each seafood category. For one thing, you lose a lot of information on how much mercury concentration varies within a category. Take tilefish, for example. This is one of the species that EPA and FDA advise pregnant women not to eat. But there are relatively few studies of tilefish, and the mean mercury concentrations they measured vary by an order of magnitude.

Click on the image below to bring up the full interactive Tableau Public visualization:

Hg in seafood

Click on the image to see full version

Satellite Image Time Lapse of Artisanal Mining in Peru

My last post was about gold and mercury prices, and how we might measure their relationship. We would expect a relationship between prices of these metals because mercury is used in artisanal and small scale gold mining (ASGM). We may or may not see a signal in mercury prices related to ASGM, but we most definitely see the effects of ASGM on the landscape on a massive scale. Using the Landsat Annual Timelapse tool in Google Earth Engine, I created this animation showing the explosive growth of ASGM and associated deforestation near Huaypetue in the Madre de Dios region of Peru. Click on the image below to view the animation.

asgm landsat anim

You can see that beginning in the late 1990s, large areas around rivers turn from green (rain forest), to brown (cleared areas for mining). The trend seems to accelerate in the last 10-15 years. You can explore the region as it appears today in Google Maps:

And because it’s fun to play with Google maps, here is a striking oblique image of the region.

Zooming in a bit closer, seen from a plane flown by the Carnegie Airborne Observatory, the impacts of mining come into even sharper view:

The scenes on the ground look every bit as desolate as you would expect from the satellite and airborne imagery:

If you are looking for more information on artisanal mining in Madre de Dios, this article in Nature is a good place to start. The Guardian has also been covering this region. This piece focuses on mercury use in mining and its toxic impacts.

Is Artisanal Gold Mining Driving the Price of Mercury?

This is the second in a multiple part series on mercury. In the last post, we explored global mercury prices and production over the last century. In this post, my aim is to answer the following questions: Is is possible to resolve a signal in the price of mercury that is attributable to its use in gold mining? Could the price of mercury be used as a predictor of the amount of gold produced using mercury?

First, some background.  Mercury has a very interesting property in that it forms amalgams with other metals.  A silver dental filling is an amalgam of mercury and silver. If you add mercury to ore or sediment containing gold, the mercury will suck up some of the gold into an amalgam. Then you can heat the amalgam to evaporate the mercury, leaving you with just gold.

This method was used for centuries to recover gold and silver. Today, large-scale industrial mines use other methods that are more efficient and do not release persistent, toxic, and bio-accumulative mercury into the environment. However, mercury is still widely used in artisanal and small-scale gold mining (ASGM). In fact, mercury use in this sector is probably increasing, and is now believed to be the largest source of mercury pollution in the world. The recent spike in gold prices is often cited as a cause of increased ASGM and associated mercury use.

Because ASGM activity is decentralized, often illegal, and commonly occurs in hard to reach parts of developing countries, it is very difficult to estimate the magnitude and trends of mercury use. But we do have data from the USGS on the prices of gold and mercury. In the last post we looked at the time series for mercury prices since 1900. Here, we are only going to look at the period from 1980-2011. (The modern ASGM period really started around 1980.) The chart below shows the inflation-indexed prices of mercury and gold. I’ve normalized them to an index where the 1980 price equals one so that I can show both series on one plot.hg.auMercury and gold prices appear to be closely correlated. The high correlation coefficient (0.89) confirms what we see in the plot. The series only diverge significantly after 2009, and we’ll look at that period more closely at the end of the post.

But the close correlation of mercury and gold prices is not enough to conclude there is a causal relationship. Perhaps there is a lurking variable that is correlated with the prices of both metals. Mercury and gold are certainly not substitutes for each other. No one buys mercury when they are worried about inflation, for example. But maybe mercury and gold prices are both are correlated to overall commodity prices. To find out I plotted an index of metals prices from the IMF (also normalized to one and corrected for inflation) together with the metals correlation looks close, and indeed the the correlation coefficients of  the metals price index with the prices of  gold and mercury are both about 0.8. This is not quite as close as the correlation of gold and mercury prices to each other, but it’s too close to conclude that either time series is all that different from the overall trend in commodity metal prices.

Now is a good time to point out that mercury has other uses besides to gold mining, such as in certain products (like thermometers) and industrial processes (like making chlorine). Demand from these other uses is going to affect the price. Of course, the supply of mercury will also have an affect on price. In attempting to see a signal in the price of mercury caused by gold mining, the implicit assumption is that other factors affecting the price of mercury (the supply and demand) remain relatively constant with respect to each other over the time period. This is not a terrible assumption. In general both non-ASGM demand for mercury and mercury supply have been decreasing over the last 30 years. But the assumption does introduce some real uncertainly into the analysis. It is difficult to correct for because we don’t have good data on mercury use by sector over the time period.

There’s one more problem. Recall that the hypothesis is that mercury use in ASGM affects the price of mercury. We were using the price of gold as a proxy for mercury use in ASGM. That sounds like a reasonable assumption. High gold prices should mean more gold being extracted, and greater demand for mercury to extract the gold.  But what really determines mercury use is the amount of gold produced, not the price. And we actually have data on global gold production. It tells a different story:au.qIf anything, global gold production is negatively correlated with gold price over the last ~30 years! I don’t know why this is. One possible explanation has to do with the lag time of starting a mining operation. Perhaps the record high gold prices of the late 1970s and early 1980s caused a wave of exploration and new mines. Once those mines were developed, they could produce gold economically even at low prices. Perhaps technology improved so that it was cheaper to find and develop gold deposits.

This leads to one more complicating factor. Most gold is produced by large scale mines (which do not use mercury). Common estimates suggest that only about 12-20% of gold is produced by rough artisanal miners. Another implicit assumption in this analysis has been that the fraction of gold produced by ASGM has remained constant over time. But this may not be the case. Small-scale miners are likely to be able to take advantage of high gold prices more quickly than the majors, where exploration, permitting, and construction can mean many years before a mine becomes operational. Small-scale miners can often start mining almost immediately. This would mean than gold and mercury prices would be more closely correlated than one would expect when looking at global gold production. On the other hand, work by the Artisanal Gold Council has shown ASGM prevalence is “sticky” with respect to gold prices. That is, once they start mining, artisanal miners are likely to continue their operation even after the price of gold drops. 

Finally, let’s reexamine the period from 2009-2011, when the price of mercury rises much more rapidly that the price of gold. I don’t think there’s an obvious explanation for this. Perhaps mercury use in ASGM really takes off in this period. Another wrinkle is the establishment of bans on mercury export in the EU (took effect in 2011) and the U.S. (took effect in 2013). Maybe buyers were trying to purchase European and U.S. mercury ahead of the ban, driving up the price. We could look at export data to find out.

As you can see, this is an extremely complicated issue. Without better data, it is not possible to resolve a signal in mercury prices that can be attributed to gold prices or gold production. Even though this exercise did not yield a clear result, I think it is important to document the effort. In data analysis (and science in general), the lack of a clear conclusion is in itself  an important piece of information.

In the next mercury installment we’ll travel to Ukraine and Kyrgyzstan to learn how the elusive metal is wrested from the earth and what sorts of environmental, economic, and social impacts this mining brings.

From Miracle Metal to Global Health Risk: A 100-Year History of Mercury Prices and Production

I want to write a series of posts about mercury production, prices, and trade. Although this may seem like a rather esoteric subject, I hope to convince readers that it’s actually pretty interesting. I have a professional interest in mercury as a global pollutant, having worked on negotiations for the Minamata Convention. These posts will also be good opportunity to practice data manipulation, graphics, and analysis in R, a powerful programming language for statistical computing.

Mercury is a pretty amazing substance. It’s the only metal that is a liquid at room temperature, a property that has long been a source of fascination to people, and led to a wide range of applications in industry. Unfortunately, mercury is also a toxin that has harmful effects on both people and the environment.

In this post I’ll examine the price and global production of mercury over the last hundred years or so using data from the U.S. Geological Survey. First, let’s look at the price of mercury in constant 1998 dollars since 1900:

mercury price

You can see that prices have fluctuated quite a bit. Let’s examine the three prominent peaks in the time series and try to figure out what caused them. Now, high prices could mean increased demand, tight supply, or a combination of both. We need to look at global mercury production over the same time period to help shed light on the variations in mercury price:
global mercury production
The first price peak occurred in the late 19-teens, around the time of WWI. In fact, I would posit that it is a direct consequence of WWI. Mercury fulminate is an explosive compound that was commonly used in the last century as a primer for small arms ammunition. They probably used a lot of it during the First World War.

Incidentally, you may recognize mercury fulminate from the TV show Breaking Bad. Walt made some and used it to blow up a group of rival drug dealers. There’s even a MythBusters segment about it.

The second price spike occurred during WWII. This was likely a result of increased demand for use in fulminate explosives, and perhaps in switches and other such products for wartime equipment. Mercury production actually increased quite a bit during the war, but it was apparently not enough prevent high prices. In response to the German invasion, the Soviets moved their main center of mercury production from Nikitovka in Ukraine to Khaidarkan in Kyrgyzstan. I’ll talk about both of these places in a later post.

The last price peak occurred in the 1960s. The causes are a bit more complex. My guess is that a combination of industrial and military uses were driving up demand, and production, although increasing, could not keep up. During this time the United States was building up its national defense reserves of mercury, and other countries were probably doing the same. One defense-related use of mercury was to separate lithium isotopes for use in hydrogen bombs. Hundreds of tons of mercury were spilled at Oak Ridge National Laboratory during isotope separation, and environmental contamination remains to this day. Another use of mercury that never came to be was as a coolant (to replace water) for nuclear reactors.

These were heady days in the mercury business, before the human health and environmental impacts were widely know. This fascinating newsreel from 1955 gives you a flavor of what the times were like:

Mercury prices (and production) started dropping in the 1970s as alternatives to industrial uses were found and the health risks started to become clear. But prices have been growing rapidly in recent years. In the next post I’m going to examine this and look at the degree to which artisanal gold mining might be responsible.