- 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 do I let my Matplotlib plot go beyond the axes?
To let my matplotlib plot go beyond the axes, we can turn off the flag clip_on in the argument of plot() method.
Steps
Create xs and ys data points using numpy.
Limit the X and Y axis range in the plot to let the line go beyond this limit, using xlim() and ylim() method.
Plot the xs and ys data points using plot() method, where marker is a diamond shape, color is orange and clip_on=False (to go beyond the plot).
To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True xs = np.arange(10) ys = np.arange(10) plt.xlim(0, 5) plt.ylim(0, 5) plt.plot(xs, ys, marker='d', c='orange', markersize=10, clip_on=False, zorder=10) plt.show()
Output
- Related Articles
- How do I plot multiple X or Y axes in Matplotlib?
- How do I plot only a table in Matplotlib?
- Plot 3D bars without axes in Matplotlib
- How do I plot hatched bars using Pandas and Matplotlib?
- How do I plot Shapely polygons and objects using Matplotlib?
- How to get a matplotlib Axes instance to plot to?
- How to plot sine curve on polar axes using Matplotlib?
- How to plot a point on 3D axes in Matplotlib?
- How can I hide the axes in Matplotlib 3D?
- Plot a vector field over the axes in Python Matplotlib?
- How do I plot a step function with Matplotlib in Python?
- Plot scatter points on 3d plot without axes and grids in Matplotlib
- How to plot single data with two Y-axes (two units) in Matplotlib?
- How to hide axes but keep axis-labels in 3D Plot with Matplotlib?
- How do I make the width of the title box span the entire plot in Matplotlib?

Advertisements