0

I cannot get bold axis labels and ticks labels when the font is Times New Roman. However, bold option works with other fonts. I am suing python 3.7 and matplotlib 3.1.3. Please help!

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt


mpl.rcParams['font.size'] = 15
mpl.rcParams['font.weight'] = 'bold'
mpl.rcParams['axes.labelweight'] = 'bold'


print(f'Matplotlib Version: {mpl.__version__}')
# Matplotlib Version: 3.1.3


# FIGURE 1 (TIMES NEW ROMAN)
mpl.rcParams['font.family'] = 'Times'

fig, ax = plt.subplots()
ax.plot(np.random.randn(100), '-k')
ax.set_xlabel('Test 1')
ax.set_ylabel('Test 2')
ax.set_title('TIMES NEW ROMAN')
plt.show()
plt.close()


# FIGURE 2 (ARIAL)
mpl.rcParams['font.family'] = 'Arial'

fig, ax = plt.subplots()
ax.plot(np.random.randn(100), '-k')
ax.set_xlabel('Test 1')
ax.set_ylabel('Test 2')
ax.set_title('ARIAL')
plt.show()
plt.close()


[Times New Roman][1]
[Arial][2]

  [1]: https://i.stack.imgur.com/kyn8C.png
  [2]: https://i.stack.imgur.com/mVZlU.png

0 Answers0