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:
import numpy as np
import matplotlib.pyplot as plt
plt.figure(1)
plt.ylabel('y')
plt.xlabel('x')
for t in xrange(50, 61):
plt.title('f model: T=t')
for i in xrange(4, 10):
plt.plot(1.0 / i, i ** 2, 'ro')
plt.legend
plt.show()
In the argument of plt.title()
, I want t
to be variable changing with the loop.