Setting up matplotlib to display Chinese character fonts in windows

1. Find the configuration path of the default font

Execute the following code

import matplotlib
print(matplotlib.__path__)

Get the default font path

2. Replace the default font

Download Chinese fonts

Open the default path folder and find
mpl-data/fonts/ttfthis directory under the folder,
then delete or rename DejaVuSans.ttf
Copy the downloaded font file and rename it to DejaVuSans.ttf

 

Guess you like

Origin blog.csdn.net/h4241778/article/details/108700253