#240 basic area chart

 

 

 

 

An area chart can easily be done using python and matplotlib. Note that there are 2 main functions allowing to draw them. I advise to use the fill_between function that allows easier customisation. The stackplot function could work as well, but is more adapted for stacked area charts. The inputs are the same than for a scatterplot: 2 numerical variables.

 

 

 

 

 

 


# library
import numpy as np
import matplotlib.pyplot as plt

# Create data
x=range(1,6)
y=[1,4,6,8,4]

# Area plot
plt.fill_between(x, y)
plot.show()

# Note that we could also use the stackplot function:
#plt.stackplot(x,y)
# but fill_between is more convenient for future customization.

Leave a Reply

Your email address will not be published.