Hatch is used to fill a pattern in a specified area. We will learn how to use it in this recipe.
Using hatch
Getting ready
Import the required libraries:
import matplotlib.pyplot as plt
import numpy as np
How to do it...
The following code block creates five charts that represent a tie, with different colors and patterns printed on them:
# Set up the data
x = np.array([0.2, 0.4, 0.6, 0.8, 0.5])
y = [1, 6, 6, 1, 0]
# Plot a tie graph 5 times with different colors and hatches
plt.fill(x+1, y, color='g', hatch='+*')
plt.fill(x+2, y, color='b', hatch...