Python 如何在图表标题中包含运行次数

Python 如何在图表标题中包含运行次数,python,python-3.x,matplotlib,Python,Python 3.x,Matplotlib,我正在使用python3x进行模拟。我使用matplotlib制作了一个图形。我想在图表标题中包含N的值,即运行次数。如何做到这一点 有两种可能的方法:(我把其中一种注释掉了) 样本图 N = 100 # Runs # Way 1 plt.title('Number of runs = %d' %N) # Way 2 # plt.title('Number of runs = {}'.format(N))

我正在使用
python3x
进行模拟。我使用
matplotlib
制作了一个图形。我想在图表标题中包含
N
的值,即运行次数。如何做到这一点

有两种可能的方法:(我把其中一种注释掉了)

样本图

N = 100 # Runs

# Way 1
plt.title('Number of runs = %d' %N) 

# Way 2
# plt.title('Number of runs = {}'.format(N))