Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyplot - negative numbers are not displayed correctly

When I change the default font to "Times New Roman", the negative numbers are not displayed correctly. I was wondering what the problem is and how I can solve it. I am using either plt.rcParams["font.family"] = "Times New Roman" or plt.rc('font',family='Times New Roman'). Here are the pictures for default font and new font, respectively.

enter image description here enter image description here

like image 933
Shannon Avatar asked Jul 14 '26 09:07

Shannon


1 Answers

As @WillemVanOnsem mentioned in the comment below original question, it can be solved by using plt.rcParams['axes.unicode_minus'] = False

like image 51
Shannon Avatar answered Jul 18 '26 11:07

Shannon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!