How do I fit long title?

后端 未结 4 865
北恋
北恋 2020-12-25 12:47

There\'s a similar question - but I can\'t make the solution proposed there work.

Here\'s an example plot with a long title:

#!/usr/bin/env python

i         


        
4条回答
  •  一个人的身影
    2020-12-25 13:13

    One way to do it is to simply change the font size of the title:

    import pylab as plt
    
    plt.rcParams["axes.titlesize"] = 8
    
    myTitle = "Some really really long long long title I really really need - and just can't - just can't - make it any - simply any - shorter - at all."
    plt.title(myTitle)
    plt.show()
    

    enter image description here

    In the answer you linked are several other good solutions that involve adding newlines. There is even an automatic solution that resizes based off of the figure!

提交回复
热议问题