1

Is it possible to have some but not all letters of an axes title in bold? I could not find anything in the documentation, but wondering if there is a workaround.

Example:

fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.plot([1,2,3])
ax2.plot([-1,-2,-3])

ax1.set(title="A. line with positive slope")
ax2.set(title="B. line with negative slope")

# want...
ax1.set(title="bold(A.) line with positive slope")

I would like A. and B. to be bold in the titles.

Daniel
  • 11,332
  • 9
  • 44
  • 72

1 Answers1

1

Try this:

import matplotlib.pyplot as plt

fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.plot([1,2,3])
ax2.plot([-1,-2,-3])

# ax1 = plt.gca() 
ax1.set(title=r'$\bf{A}$. line with positive slope')
ax2.set(title=r'$\bf{B}$. line with negative slope')

enter image description here

blunova
  • 2,122
  • 3
  • 9
  • 21