Rarefaction curves in Python

Rarefaction assesses how dense is the population of that species using rarefaction curve. Rarefaction calculates the density of population using rarefaction curve.

In this tutorial, we are going to learn the method of plotting a rarefaction curve using EcoPy module of Python. This module contains techniques to explore complex multivariate data.

First, we will install the EcoPy module if it isn’t already installed.

pip install ecopy

Now we will write a small code to make a rarefaction curve for ‘BCI’ data.

rarefy(x,method=”rarefy”,size=None, breakNa=True): This returns rarefied species richness or draws a rarefaction curve.Here ‘x’ is a species matrix. The method can be either “rarefy” or “rarecurve”.

“rarefy” : It returns the species richness.

“rarecurve”: returns the rarefaction curve.

Example code:

import ecopy as ep  
BCI = ep.load_data('BCI')
rareRich = ep.rarefy(BCI, 'rarefy')
ep.rarefy(BCI, 'rarecurve')

This will be a rarefaction curve showing Number of individuals v/s number of species.

Leave a Reply

Your email address will not be published. Required fields are marked *