Set facecolor for the filled area, edgecolor for its boundary, hatch for the pattern, and hatchcolor for the pattern strokes. These are separate style properties on the collection returned by fill_between.
Set the fill, outline, and hatch colors separately
Pass the style arguments directly to fill_between. This example fills the region between zero and a sine curve where the curve is nonnegative:
As an Amazon Associate I earn from qualifying purchases.
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 200)
y = np.sin(x)
fig, ax = plt.subplots()
ax.plot(x, y, color="navy")
ax.fill_between(
x, 0, y,
where=y >= 0,
facecolor="lightblue",
edgecolor="navy",
hatch="//",
hatchcolor="crimson",
)
plt.show()
The color values illustrate the documented arguments; the example is not a claim about a tested rendering result. The fill_between API documents the function and its collection properties.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWhat each style property controls
facecolor(orfc) colors the interior of the filled polygon. Face colors may be a single color or a sequence cycled over patches.edgecolor(orec) colors the polygon boundary. Set it to'face'to match the face color.hatchselects the pattern drawn across the filled area. A non-empty pattern is needed for hatch marks.hatchcolorcolors the hatch strokes. It accepts a color or'edge', which uses the edge color.
Because hatch color is independent, it can differ from both the fill and outline. Matplotlib’s hatchcolor example demonstrates a red hatch with a black edge on a patch; the API and collections reference establish the corresponding collection styling for fill_between.
#1 Best Overall
Choose a hatch pattern and density
Documented hatch characters include /, , |, -, +, x, o, O, ., and *. Combine characters for a composite pattern, or repeat one to increase its density—for example, '/' is sparser than '///'. The pattern is configured for the collection as a whole, not separately for each polygon member. See the hatch style reference.
If hatch marks do not appear
Check that hatch is non-empty, then check the rendering backend. Matplotlib’s hatch reference lists support in PS, PDF, SVG, macosx, and Agg; WX and Cairo are listed as unsupported. A hatch may therefore appear in one output path but not another if different backends are used.
Rank #2
Version considerations
The current stable documentation pages identify Matplotlib 3.11.2. The collections reference notes that Collection.set_color also sets hatch color as of version 3.11; that note concerns set_color and does not establish the first version that accepted the hatchcolor argument. If your code must support older Matplotlib installations, check the installed version’s API before relying on that argument. The collections API documents the property.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesQuick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




