- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 make an arrow that loops in Matplotlib?
To make an arrow that loops in Matplotlib, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- To make an arrow loop in matplotlib, we can use make_loop() method.
- Make a wedge instance with center, radius, theta1, theta2 and width.
- To put the arrow top of the loop, use PathCollection.
- Add patch collection to the current axes.
- To display the figure, use show() method.
Example
from matplotlib import pyplot as plt, patches, collections plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True def make_loop(center, radius, theta1=-30, theta2=180): rwidth = 0.02 ring = patches.Wedge(center, radius, theta1, theta2, width=rwidth) offset = 0.02 xcent = center[0] - radius + (rwidth / 2) left = [xcent - offset, center[1]] right = [xcent + offset, center[1]] bottom = [(left[0] + right[0]) / 2., center[1] - 0.05] arrow = plt.Polygon([left, right, bottom, left]) p = collections.PatchCollection( [ring, arrow], edgecolor='orange', facecolor='red' ) ax.add_collection(p) fig, ax = plt.subplots() make_loop(center=(.5, .7), radius=.1) plt.show()
Output
- Related Articles
- How do I specify an arrow-like linestyle in Matplotlib?
- How to make loops run faster using Python?
- How to define an Arrow Function in JavaScript?
- How to create an arrow in base R?
- How to make axes transparent in Matplotlib?
- How to sorting an array without using loops in Node.js?
- An archer shoots an arrow in the air horizontally. However, after moving some distance, the arrow falls to the ground. Name the initial force that sets the arrow in motion. Explain why the arrow ultimately falls down?
- How to make a multicolored point in Matplotlib?
- How to make the Parula colormap in Matplotlib?
- How to make joint bivariate distributions in Matplotlib?
- How to make a rug plot in Matplotlib?
- How to make a mosaic plot in Matplotlib?
- How to make markers on lines smaller in Matplotlib?
- How to make longer subplot tick marks in Matplotlib?
- How to make a simple lollipop plot in Matplotlib?

Advertisements