Python | Hatching Head of the Arrow

In this article, we are going to hatch the head of the arrow (with default shape) using the hatch command of matplotlib.
Submitted by Anuj Singh, on July 31, 2020

Through this tutorial, we are trying to present different types of hatch that are possible in an arrow. Any of them can be used for different applications. Following are the plots as an output from the python code.

Python | Hatching Head of the Arrow (1)

Python | Hatching Head of the Arrow (2)

Python | Hatching Head of the Arrow (3)

Python | Hatching Head of the Arrow (4)

Python | Hatching Head of the Arrow (5)

Python code for hatching head of the arrow

import matplotlib.pyplot as plt

plt.figure()
plt.arrow(0.05, 0.2, 0.5, 0, linewidth=3.0, hatch='+', 
          head_width=0.15, head_length=0.25)
plt.title('Hatched Head')
plt.show()


plt.figure()
plt.arrow(0.05, 0.2, 0.5, 0, linewidth=3.0, hatch='-', 
          head_width=0.15, head_length=0.25)
plt.title('Hatched Head')
plt.show()


plt.figure()
plt.arrow(0.05, 0.2, 0.5, 0, linewidth=3.0, hatch='/', 
          head_width=0.15, head_length=0.25)
plt.title('Hatched Head')
plt.show()


plt.figure()
plt.arrow(0.05, 0.2, 0.5, 0, linewidth=3.0, hatch='o', 
          head_width=0.15, head_length=0.25)
plt.title('Hatched Head')
plt.show()

plt.figure()
plt.arrow(0.05, 0.2, 0.5, 0, linewidth=3.0, hatch='.', 
          head_width=0.15, head_length=0.25)
plt.title('Hatched Head')
plt.show()

Output:

Output is as figure


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.