user2938093 user2938093 - 2 years ago 118
Python Question

Make part of a matplotlib title bold and a different color

I would like to change part of a title to be bold. For example:

plt.title("This is title number: " + str(number))

Given a title like the above, how would I bold the str(number) part.

Answer Source

activate latex text rendering

from matplotlib import rc rc('text', usetex=True)

plt.title("This is title number: " + r"\textbf{" + str(number) + "}")

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download