Reputation: 15
folks. Does anyone know how to rotate the title text for several subplots like this:
A slight difference between the above images and my desired images is that, each face image in my whole figure was displayed by an individual subplot. And I want to add a rotated title for each subplot figure.
Upvotes: 0
Views: 3576
Reputation: 39052
A minimal working answer for you. I hope it helps.
import numpy as np
import matplotlib.pyplot as plt
f, (ax1, ax2) = plt.subplots(1, 2, sharey=False, figsize=(10,4))
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x)
ax1.plot(x, y)
ax1.set_title('Title 1', y=1.1, rotation = 45) # You can vary y and angle as per choice
ax2.plot(x, 1.5*y)
ax2.set_title('Title 2', y=1.1, rotation = 45)
Output
Upvotes: 3