
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Print Y-axis Label Horizontally in Matplotlib Pylab Chart
Just by using plt.ylabel(rotation='horizontal'), we can align a label according to our requirement.
Steps
Plot the lines using [0, 5] and [0, 5] lists.
Set the y-label for Y-axis, using ylabel method by passing rotation='horizontal'.
Set the x-label for X-axis, using xlabel method.
To show the plot, use plt.show() method.
Example
from matplotlib import pyplot as plt plt.plot([0, 5], [0, 5]) plt.ylabel("Y-axis ", rotation='horizontal') plt.xlabel("X-axis ") plt.show()
Output
Advertisements