Get Growing Blog

Coding in plant biology, who knew?

May 1, 2020

Leaves

I never viewed myself as a math person, let alone a computer coder. I have always loved nature, animals and plants, these are what drew me to plant biology. But somehow, coding has become one of my favorite parts of my research at Holden Forests & Gardens. Looking back, maybe it isn’t too surprising. In 1977 my mother was one of the few women in the world working on a graduate degree in computer science, with 7-year-old me in tow as she taught her evening course. She jokes about how I used to doodle with my markers and then raise my little hand to ask and answer questions in her class, and now I often reflect on this as the first moments of joy I found in coding. 

For me, science is about action, solving problems. So, it was a shock at first when I found that I can completely lose myself in coding. On the surface coding seems static, boring, you are just staring at a computer full of seemingly indecipherable strings of text. But I can spend an afternoon, a week, a month, going back and forth with the code, futzing and studying how to achieve the outcome that I can see in my mind. Coding actually has a special kind of hands-on feel. It is problem solving in its purest form. And, unlike most scientific problems, with coding I can see the results of my efforts emerge almost miraculously, after all the commands are correctly written, when that last missed comma is finally put in place.  

In my work at Holden, I use coding primarily to analyze my data and draw figures showing the data we collect, although we also use coding to run devices that measure plant function. We use a coding language called “R”. It’s what’s known as an “object-oriented” language, meaning that you make objects, like a mathematical formula for example, and then you can manipulate the objects by putting them on a graph or passing the result of the formula on to another formula. R has become very popular with biologists because it has infinite capacity to develop new approaches, new methods for data. R is also popular because anyone can build an “R package” which is just a bit of code that simplifies complex coding problems by giving you standard formulas to use. In addition to being popular among scientists, R is used extensively by media outlets to create many of the beautiful graphs you see on webpages. Here you see code for a graph that I am making using a package called “ggplot”. A lot of the code looks confusing, but if you focus on the individual lines you can see familiar words, like the names of colors. 

That code makes a figure showing data we collected on Rhododendron flowers. For this project, we were interested in how leaf and flower traits work together to help plants survive and reproduce in stressful environments. We looked at leaf traits (shown in green), and flower traits like the size of male reproductive structures (blue), the size of the female reproductive structures (gold) and the size of the flowering branch (pink). In this type of graph we can see that some traits are close together, for example leaf size and stigma diameter (shown as STIG_diam). Their close proximity shows that these traits are strongly correlated, such that Rhododendrons with bigger leaves will also have larger stigmas. Other traits are far apart, for example leaf size is far from all the male traits in blue, which means that Rhododendrons can change their leaf size without a change in their male traits. Why does this matter? The correlations between traits has a huge effect on the evolution of diversity, because it determines which traits might be mixed and matched as species adapt to new environments.  

At the end of the day, coding brings me joy because it’s about solving the problem of how to show my data to the world. Sharing your data is the last, and perhaps most important step in science. Next time you see a beautiful computer graphic, remember, you are actually looking at computer code. Although this joy I have found in coding was totally unexpected, in retrospect, it clearly combines all the interests that I had as a marker doodling 7-year-old, and yes I am still raising my hand to ask questions about coding! 

Juliana S. Medeiros, PhD

Juliana S. Medeiros, PhD

Plant Biologist

My research focuses on plant anatomical and physiological acclimation and adaptations to the abiotic environment. I am interested in how phenotypic and genetic variation in plant form and function interact with variation in climate over space and time to drive ecological patterns and the evolution of plant diversity. I focus primarily on plant hydraulic traits, including xylem water transport, leaf gas exchange and the integration of leaf and xylem function.  Click here to learn more about research in my lab: Medeiros Lab Webpage

Learn more about me

Here’s more to explore

View all

What can we help you find?

Return to site

Debug info for popularity tracking: Disable within popularity-tracking.php file once ready.

Time: 1715817600 / Saved: 1715731200

Views (7 day(s) ago): 3

Views (6 day(s) ago): 2

Views (5 day(s) ago): 2

Views (4 day(s) ago): 1

Views (3 day(s) ago): 1

Views (2 day(s) ago): 2

Views (1 day(s) ago): 1

Views (Today): 1