Make part of a matplotlib title bold and a different color

From matplotlib version 2 on,
there is no need to use latex (which would require a working latex installation). One can use normal MathText to render part of the title in bold.

import matplotlib.pyplot as plt
number = 2017
plt.title("This is title number: " + r"$\bf{" + str(number) + "}$")

enter image description here

Leave a Comment