Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Matplotlib: Set hatching pattern for bar plot

📅 2012-Oct-02 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ bar plot, hatching pattern, matplotlib ⬩ 📚 Archive

Matplotlib is a plotting library written in Python that supports creation of bar plots. By default, the bars in such a plot are filled with colors with no hatching pattern.

To set a hatching pattern assign it to the named argument hatch in the call to pyplot.bar():

matplotlib.pyplot.bar( ..., hatch="/" )

The list of all supported hatching patterns and their usage can be found here.

Tried with: Matplotlib 1.2, Python 3.2.3 and Windows 7 x64


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email