Matplotlib Bar Chart: Display textures to bars and wedges
Matplotlib Bar Chart: Exercise-17 with Solution
Write a Python program to add textures (black and white) to bars and wedges.
import matplotlib.pyplot as plt fig = plt.figure() patterns = [ "|" , "\\" , "/" , "+" , "-", ".", "*","x", "o", "O" ] ax = fig.add_subplot(111) for i in range(len(patterns)): ax.bar(i, 3, color='white', edgecolor='black', hatch=patterns[i]) plt.show()
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework