2

I have following python code:

import matplotlib.pyplot as plt
plt.plot(1,1,label=r'$\alpha$')
plt.plot(1,1,label=r'$V_b^0$')
plt.legend()
plt.show()

Labels are not showing correctly. Instead of \alpha there is *, instead of V_b^0 there is V_b^E.

Wrong labels

I work on new PC. What should I change in order to make in work properly. I haven't got this problem before on any other laptops, PCs I have worked.

Kasia Kowalska
  • 143
  • 2
  • 10
  • 1
    When I run the code it looks [like this](https://i.stack.imgur.com/pw0eh.png). So it is you who need to tell us in how far your PC differs from any usual system. In general I would recommend using the newest version of matplotlib - yours seems to be older than 2 years. – ImportanceOfBeingErnest Nov 16 '17 at 11:53
  • The system is Centos7. I need to log job into IT service anytime I want update, upgrade, etc. So what you suggest is an matplotlib upgrade? – Kasia Kowalska Nov 16 '17 at 12:00
  • I would anyway recommend using the latest matplotlib version. Given that the code itself is correct, it would be hard to find the cause otherwise. Of course you could play around with fonts, trying to change the legend font etc. But at the end a fresh new matplotlib install would probably solve the problem directly. – ImportanceOfBeingErnest Nov 16 '17 at 12:13
  • Assuming that it is more the package that you want to update more than the Python version, you can also install a version in your home folder : https://stackoverflow.com/questions/7143077/how-can-i-install-packages-in-my-home-folder-with-pip – Tom de Geus Nov 16 '17 at 16:16

0 Answers0