The visualization of rain

By Shannon Dunnigan

I am sure most of you NERRds can agree that the visualization of data is an integral part of the scientific process. In fact, I would further argue that it does not simply occur ONCE, but multiple times throughout the process. Visualization is a key step in detecting patterns and relationships within the data, which can further be tested with statistical analysis. Just through our normal workflow in conducting our long-term monitoring here at the Reserve, we visualize our data several times. Katie even created a graphic identifying these key steps in our System-Wide Monitoring Program (SWMP).

SWMP Visual Process
A flow chart describing the System-Wide Monitoring Program data process, from collection to management applications. Created by Katie Petrinec, 2017.

The majority of the visuals I make assist in the quality check and assurance (QAQC) of our SWMP data. I check to ensure that there are no errors in the data and make notes on any events that may have occurred while the data was being collected.

Check out the post where we talk about this process!

Every now and then, though, I have the chance to get creative and investigate trends and relationships in the data (cue NERRd-y excitement!). For a recent project involving our SWMP water quality data and emergent vegetation data, I looked at rainfall patterns that occurred prior to each sampling period of our vegetation monitoring. Our vegetation plots are monitored bi-annually, at the end of the dry season (typically April/May) and at the end of the wet season (around October).

So, what did I do?

Well, I was interested in not only total rainfall in the months leading up to these sampling periods but also the number of rainy days. As an example, seeing a total of 10 inches of rain in the three months before April would be interesting, but when you also show that this rain occurred in 3 days? That is a LOT of rainfall within a short period of time. Or, conversely to that, say that same amount of rainfall occurred over 27 days; sure paints a different picture, huh?

With the help of Marcus Beck and Kari Pohl on (thanks, guys!), I created a visualization of these rain days before each vegetation monitoring season.


Using the data from our weather station (you can get it here), I calculated the daily total precipitation for the three months before the spring vegetation sampling (February, March, April) and the fall sampling (July, August, September). I then created a new variable which put each of these rain days into one of three categories: a “wet” day, where there was more than 10 mm (~0.4 inches) of rain; a “very wet” day, where there was more than 20 mm (~0.8 inches) of rain; and an “extremely wet” day, where there was more than 30 mm (~ 1.2 inches) of rain.

I did several other things with the data to end up with the final plot, but now I can see the number of rain days within each category, in each season, across all the years we have been monitoring our emergent vegetation. Looks like there are more rain days leading into the fall sampling season (makes sense as that IS the end of our wet season), except for in 2016, which was a much drier year. We also experienced more “extremely wet” days prior to 2015.

I love creating visuals like this! Leave a comment below if you like this kind of stuff, too. And, feel free to share any recent visuals of your data!

Let’s be NERRd-y together!



Interested in the R code for this plot, check it out below!

p <- ggplot(data = day.met.r2, aes(x = season, fill = rain)) +
geom_histogram(stat = "count", width = 0.8, position = "stack") +
facet_grid(. ~ year, switch="both")+ # this is to separate by the years
scale_y_continuous(expand = c(0,0)) + # this is to make the O of y-axis start ON the x-axis
theme_minimal() +
theme(axis.title.x = element_blank(), axis.title.y=element_text(size=11),
plot.title=element_text(size=11, face="bold"),
axis.text.x = element_text(angle = 90),
legend.position = "bottom",
legend.title = element_blank(),
strip.placement = "outside",
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"))+
labs(x='', y='Number of rain days',
title='Rainy Days prior to each seasonal Vegetation Monitoring',
subtitle ='Spring (Feb-Apr) and Fall (Jul-Sep)')+
scale_fill_brewer(palette="Paired") +
scale_x_discrete(limits=c('Spring','Fall')) # to reorder x axis so that spring is before fall

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.