When we use the Matplotlib library to draw pictures, the following errors are easy to occur, and the drawn chart icons will appear garbled errors, Chinese cannot be displayed, etc., and the operation errors are as follows. What should I do at this time?
Next we write about the following solution:
plt.rcParams['font.sans-serif']=['SimHei'] #显示中文标签
plt.rcParams['axes.unicode_minus']=False #解决负号“-”显示为方块的问题
The above two lines of code can solve the garbled characters, the Chinese cannot be displayed, and the minus sign shows the box. Let's take a look at the revised result: the
problem is easily solved, and comments are welcome to have a better way.