- 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
Rotating axes label text in 3D Matplotlib
To rotate axes label text in 3D matplotlib, we can use set_zlabel() method with rotation in the method's argument.
Steps
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.
Add a subplot to the current axis with projection="3d".
Initialize a variable, angle, for an angle.
Set Z-axis label using set_zlabel() method with a rotation.
To display the figure, use show() method.
Example
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure() ax = fig.add_subplot(111, projection='3d') angle = 45 ax.set_zlabel('Z-Axis', rotation=angle) plt.show()
Output
- Related Articles
- Animate a rotating 3D graph in Matplotlib
- How to save Matplotlib 3d rotating plots?
- Plot 3D bars without axes in Matplotlib
- How can I hide the axes in Matplotlib 3D?
- Rotating axis text for each subplot in Matplotlib
- Bold font weight for LaTeX axes label in Matplotlib
- How to plot a point on 3D axes in Matplotlib?
- How to show legend and label axes in 3D scatter plots in Python Plotly?
- Plot scatter points on 3d plot without axes and grids in Matplotlib
- How to hide axes but keep axis-labels in 3D Plot with Matplotlib?
- How to label and change the scale of a Seaborn kdeplot's axes? (Matplotlib)
- How do you just show the text label in a plot legend in Matplotlib?
- How to switch axes in Matplotlib?
- Change x axes scale in matplotlib
- Creating a 3D plot in Matplotlib from a 3D numpy array

Advertisements