It is highly advised to change the default color of matplotlib. Moreover, it is quite common to use a color with transparency, and add a line with a stronger colour on the top of the area.

You can pass the color parameter to change the color of the area and the alpha parameter to change the color transparancy of the area to the fill_between() function. You can also add a line with the plot() function and change its color to make the edge of the area marked.

# libraries
import numpy as np
import matplotlib.pyplot as plt
 
# create data
x=range(1,15)
y=[1,4,6,8,4,5,3,2,4,1,5,6,8,7]
 
# Change the color and its transparency
plt.fill_between( x, y, color="skyblue", alpha=0.4)

# Show the graph
plt.show()
 
# Same, but add a stronger line on top (edge)
plt.fill_between( x, y, color="skyblue", alpha=0.2)
plt.plot(x, y, color="Slateblue", alpha=0.6)
# See the line plot function to learn how to customize the plt.plot function

# Show the graph
plt.show()

Last but not least, it is often worth it to change the style before doing your chart in order to plot a nice looking graph. Moreover, don’t forget to add a title and give names to the axis:

# libraries
import numpy as np
import matplotlib.pyplot as plt
 
# create data
x=range(1,15)
y=[1,4,6,8,4,5,3,2,4,1,5,6,8,7]

# Change the style of plot
plt.style.use('seaborn-darkgrid')
 
# Make the same graph
plt.fill_between( x, y, color="skyblue", alpha=0.3)
plt.plot(x, y, color="skyblue")
 
# Add titles
plt.title("An area chart", loc="left")
plt.xlabel("Value of X")
plt.ylabel("Value of Y")

# Show the graph
plt.show()

Timeseries

Contact & Edit


πŸ‘‹ This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! πŸ”₯

This page is just a jupyter notebook, you can edit it here. Please help me making this website better πŸ™!