How to set ticklabels in bold on x-axis when using usetex=True

45 Views Asked by At

I have the following small program in which I use rc("text", usetex = True) in order to allow some formatting.

I thought that the line ax.set_xticklabels(ax.get_xticks(), weight='bold') would show in bold the numbers showed on the x-axis.

But there's something I clearly didn't understand in all the instructions I read here and there, especially on some SO posts. So now I don't know how to get out of it...

What would be the simplest change in this program to plot these numbers in bold?

import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import rc
rc("text", usetex = True)

fig, ax = plt.subplots(figsize = (6, 3), tight_layout = True)

ax.set_yticks([i for i in range(0, 10+1, 1)])
ax.set_xticks([i for i in range(0, 100+1, 10)])
ax.tick_params(axis = "both", labelsize = 15)
ax.set_xticklabels(ax.get_xticks(), weight='bold')
ax.set_title(r"$\underline{\textbf{Proper}}$")
plt.show()
0

There are 0 best solutions below