How to add a variable to Python plt.title?

后端 未结 3 1200
生来不讨喜
生来不讨喜 2020-12-29 04:27

I am trying to plot lots of diagrams, and for each diagram, I want to use a variable to label them. How can I add a variable to plt.title? For example:

3条回答
  •  长发绾君心
    2020-12-29 05:27

    You can use print formatting.

    1. plt.title('f model: T= {}'.format(t)) or
    2. plt.title('f model: T= %d' % (t)) # c style print

提交回复
热议问题