
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to decouple hatch and edge color in Matplotlib?
To decouple hatch and edge color in matplotlib, we can use hatch color “o” and edge color “red”.−
Steps
- Create a new figure or activate existing figure.
- Add a subplot arrangement to the current axes.
- Create two lists of data points.
- Use bar() method with hatch and edgecolor.
- To display the figure, use show() method.
Example
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure() ax1 = fig.add_subplot(111) x = [3, 6, 1] y = [4, 6, 1] ax1.bar(x, y, color='black', edgecolor='red', hatch="o", lw=1., zorder=0) plt.show()
Output
- Related Questions & Answers
- How to decrease the hatch density in Matplotlib?
- How to change the linewidth of a hatch in Matplotlib?
- Plot a circle with an edgecolor and hatch in Matplotlib
- How to fill a polygon with a custom hatch in Matplotlib?
- How to set NetworkX edge labels offset in Matplotlib?
- How to plot contourf and log color scale in Matplotlib?
- How to change axes background color in Matplotlib?
- How to set a Matplotlib rectangle edge to outside of specified width?
- How to customize the color and colormaps of a Plot in Matplotlib
- How to plot a gradient color line in matplotlib?
- How to fill color below a curve in Matplotlib?
- How do I set color to Rectangle in Matplotlib?
- How do I fill a region with only hatch (no background colour) in matplotlib 2.0?
- How to set a line color to orange, and specify line markers in Matplotlib?
- Plotting a transparent histogram with non-transparent edge in Matplotlib
Advertisements