1

I'm working with Matplotlib in Python, and have the simple figure-suptitle layout shown below

  Title
----------
|Figure  |
|Pieces  |
----------

The figure pieces are squished a bit, however. To make room, I would like to put the figure suptitle on the side, like so

----------   
|Figure  | (title rotated 90 degrees) 
|Pieces  |
----------

The reason I would like to do this is that there are 47 of these, and each will go on its own 8.5" x 11" page. An alternative would be to rotate the figure itself, although I imagine that might be harder.

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158

1 Answers1

1
import matplotlib.pyplot as plt

names = ['group_a', 'group_b', 'group_c']
values = [1, 10, 100]

fig, ax = plt.subplots(3, 1, figsize=(3, 9))

ax[0].bar(names, values)
ax[1].scatter(names, values)
ax[2].plot(names, values)
fig.suptitle('Categorical Plotting', ha='right', va='center', x=1.1, y=0.5, rotation=270)
plt.show()

enter image description here

names = ['group_a', 'group_b', 'group_c']
values = [1, 10, 100]

plt.figure(figsize=(9, 3))

plt.subplot(131)
plt.bar(names, values)
plt.subplot(132)
plt.scatter(names, values)
plt.subplot(133)
plt.plot(names, values)
plt.suptitle('Categorical Plotting', ha='right', va='center', x=0.95, y=0.5, rotation=270)
plt.show()

enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158