1. Problem: Chinese cannot be displayed, it is displayed as a frame.
solve:
-
Run the code to find the path of matplotlib configuration file
import matplotlib matplotlib.matplotlib_fname()
-
Use a text editor to open
matplotlibrc
the configuration file, find#font.family:
, and#font.sans-serif
the two lines. -
Remove the comments on these two lines and
font.sans-serif:
addSimHei
(Simplified Black) after -
Restart the console and run it.
2. Problem: The negative sign cannot be displayed, which is displayed as a frame
solve:
-
Run the code to find the path of matplotlib configuration file
import matplotlib matplotlib.matplotlib_fname()
-
Open the
matplotlibrc
configuration file with a text editor , find#axes.unicode_minus:True
this line, remove the comment, and change True to False. -
Restart the console and run it.