- 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 can I hide the axes in Matplotlib 3D?
To hide the axes in matplotlib 3D, we can take the following steps−
- Create a 2D array, where x, y, z, u, v and w are the coordinates of the arrow locations and direction components of the arrow vectors.
- Using figure() method, create a new figure or activate an existing figure.
- Add an '~.axes.Axes' to the figure as part of a subplot arrangement, using add_subplot() method
- Plot a 3D field of arrows, using quiver() method.
- Using ylim, xlim, zlim, limit the range of the axes
- Set the title of the plot.
- Create two axes (ax1 and ax2). Set the titles "With Axes" and "Without Axes". Using set_axis_off() method, we can hide the axes.
- To display the figure, use show() method.
Example
import matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True soa = np.array([[0, 0, 1, 1, -2, 0], [0, 0, 2, 1, 1, 0], [0, 0, 3, 2, 1, 0], [0, 0, 4, 0.5, 0.7, 0]]) X, Y, Z, U, V, W = zip(*soa) fig = plt.figure() ax = fig.add_subplot(121, projection='3d') ax.quiver(X, Y, Z, U, V, W, color='red') ax.set_xlim([-1, 0.5]) ax.set_ylim([-1, 1.5]) ax.set_zlim([-1, 8]) ax.set_title("With Axes") ax1 = fig.add_subplot(122, projection='3d') ax1.set_axis_off() ax1.quiver(X, Y, Z, U, V, W, color='red') ax1.set_xlim([-1, 0.5]) ax1.set_ylim([-1, 1.5]) ax1.set_zlim([-1, 8]) ax1.set_title("Without Axes") plt.show()
Output
- Related Articles
- How to hide axes but keep axis-labels in 3D Plot with Matplotlib?
- How to hide axes and gridlines in Matplotlib?
- Plot 3D bars without axes in Matplotlib
- Rotating axes label text in 3D Matplotlib
- How to plot a point on 3D axes in Matplotlib?
- How can I render 3D histograms in Python using Matplotlib?
- How can I make a simple 3D line with Matplotlib?
- How can I change the font size of ticks of axes object in Matplotlib?
- Plot scatter points on 3d plot without axes and grids in Matplotlib
- How do I let my Matplotlib plot go beyond the axes?
- How do I plot multiple X or Y axes in Matplotlib?
- How to switch axes in Matplotlib?
- How to hide lines in Matplotlib?
- How to make axes transparent in Matplotlib?
- How to animate 3D plot_surface in Matplotlib?

Advertisements