user2938093 user2938093 - 1 year ago 106
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