ADVERTISEMENT
ADVERTISEMENT

Python | Title Rotation in Matplotlib

Here, we are going to learn about the title rotation in matplotlib and its Python implementation.
Submitted by Anuj Singh, on August 03, 2020

In this tutorial, we are going to rotate the title of a figure using matplotlib inbuilt command rotation=angle.

Examples:

Python | Title Rotation in Matplotlib (1)

Python | Title Rotation in Matplotlib (2)

Python | Title Rotation in Matplotlib (3)

Python code for title rotation in matplotlib

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(100)
y = np.random.randint(45,86,100)

plt.figure()
plt.plot(x,y, 'o')
plt.title('Title : ABC', loc='left', rotation=30)
plt.grid()
plt.show()

plt.figure()
plt.plot(x,y, 'o')
plt.title('Title : ABC', loc='Right', rotation=-45)
plt.grid()
plt.show()

plt.figure()
plt.plot(x,y, 'o')
plt.title('Title : ABC', loc='Center', rotation=90)
plt.grid()
plt.show()

Output:

Output is as figure
ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.