- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 draw a line outside of an axis in Matplotlib?
To draw a line (i.e., arrow) outside of an axis, we can use annotate() method,
Set the figure size and adjust the padding between and around the subplots.
Create a new figure or activate an existing figure using figure() method.
Clear the current figure.
Add an '~.axes.Axes' to the figure as part of a subplot arrangement using add_subplot() method.
Use annotate() method to place a line outside the axes.
To display the figure, use show() method.
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure(1) fig.clf() ax = fig.add_subplot(1, 1, 1) ax.annotate('', xy=(0, -0.1), xycoords='axes fraction', xytext=(1, -0.1), arrowprops=dict(arrowstyle="<->", color='b')) plt.show()
- How to draw an average line for a scatter plot in MatPlotLib?
- How to draw axis in the middle of a figure in Matplotlib?
- How to draw axis lines inside a plot in Matplotlib?
- How to draw rounded line ends using Matplotlib?
- How can I draw inline line labels in Matplotlib?
- How can I draw a scatter trend line using Matplotlib?
- How to plot multiple Pandas columns on the Y-axis of a line graph (Matplotlib)?
- How to set the unit length of an axis in Matplotlib?
- Draw a line, say $AB$, take a point $C$ outside it. Through $C$, draw a line parallel to $AB$ using ruler and compasses only.
- How to move the legend to outside of a Seaborn scatterplot in Matplotlib?
- Draw a curve connecting two points instead of a straight line in matplotlib
- How to set a Matplotlib rectangle edge to outside of specified width?
- How to draw a line in Android?
- Changing the color of an axis in Matplotlib
- How to draw an arrowed line in OpenCV using Java?