Get the title of a given figure

后端 未结 3 1145
梦如初夏
梦如初夏 2020-12-20 19:32

I have created a figure and have attached to it a title like this:

def func():
    fig = plt.figure()
    fig.suptitle(\"my title\")
    return fig
         


        
3条回答
  •  清酒与你
    2020-12-20 20:18

    You can get the title through the axes:

    fig.axes[0].get_title()
    

    In case you have access to the axis itself, you can directly do:

    ax.get_title()
    

提交回复
热议问题