1

I want to use the font 'Times New Roman' for my matplotlib plots. I tried the command:

import matplotlib as mpl

mpl.rcParams["font.family"] = "serif"

mpl.rcParams["font.serif"] = "Times New Roman"

When I just use these lines, it is fine.

But when I want to create a plot. For example a piechart with a title.

plt.pie(data, ...)

plt.title('Piechart')

plt.show()

It get this Error:

WARNING:matplotlib.font_manager:findfont: Generic family 'serif' not found because none of the following families were found: Times New Roman

Can you please explain to me what I am doing wrong and which steps I need to take.

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
booklover
  • 43
  • 6
  • Your Times might have a slightly different name. You might try to check all available fonts first [How to get a list of all the fonts currently available for Matplotlib?](https://stackoverflow.com/questions/8753835/how-to-get-a-list-of-all-the-fonts-currently-available-for-matplotlib) – herrstrietzel Apr 07 '23 at 18:09

0 Answers0