Home > Mobile >  How to place the suptitle rotated on the side of the figure
How to place the suptitle rotated on the side of the figure

Time:09-22

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.

CodePudding user response:

  • Use the rotation parameter.
  • See 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

  • Related