- 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
Draw axis lines or the origin for Matplotlib contour plot.
To draw axis lines or the origin for matplotlib contour plot, we can use contourf(), axhline() y=0 and axvline() x=0.
Create data points for x, y, and z using numpy.
To set the axes properties, we can use plt.axis('off') method.
Use contourf() method with x, y, and z data points.
Plot x=0 and y=0 lines with red color.
To display the figure, use show() method.
Example
import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(-1.0, 1.0, 10) x, y = np.meshgrid(x, x) z = -np.hypot(x, y) plt.axis('off') plt.contourf(x, y, z, 10) plt.axhline(0, color='red') plt.axvline(0, color='red') plt.show()
Output
- Related Articles
- How to draw axis lines inside a plot in Matplotlib?
- Show the origin axis (x,y) in Matplotlib plot
- Contour hatching in Matplotlib plot
- How to plot matplotlib contour?
- Adding extra contour lines using Matplotlib 2D contour plotting
- Plot Matplotlib 3D plot_surface with contour plot projection
- How do you create a legend for a contour plot in Matplotlib?
- Setting the limits on a colorbar of a contour plot in Matplotlib
- Adding caption below X-axis for a scatter plot using Matplotlib
- How to plot overlapping lines in Matplotlib?
- Matplotlib Plot Lines with Colors through Colormap
- How to remove or hide X-axis labels from a Seaborn / Matplotlib plot?
- How can Matplotlib be used to create 3 dimensional contour plot using Python?
- How to remove lines in a Matplotlib plot?
- Plot scatter points on polar axis in Matplotlib

Advertisements