Issue
On centos7/rhel7, I try to do a simple plot using an example from documentation:
#!/usr/bin/env python2
import numpy as np
import matplotlib.pyplot as plt
plt.plot(np.arange(10))
plt.title(r'$\alpha > \beta$')
print plt.__version__
plt.show()
matplotlib.__version__
shows1.2.0
(installed from RPM).plt.rcParams['text.usetext']
is set toFalse
Instead of seeing the expected greek symbols for alpha and beta i see: *©@
.
I don't want to install latex
. I don't want to use anaconda python distro.
how can I get matplotlib mathtext working on centos7/rhel7?
p.s. I tried plt.rcParams['text.usetext'] = True
but got a sh latex command not found
error (latex
is obviously not installed).
Solution
in a nutshell, you can not use the RPM installed matplotlib --> instead use a pip install version (matplotlib version 2.2.x for python2, matplotlib version >= 3.x for python3).
- for centos7 builtin python2 matplotlib it is i think version 1.2.x and it is built without lots of feature
- most likely the python2 matplotlib is built without the math
tex
because that would significantly increase the complexity of packaging and significantly increase the software deps and so they went with a more minimal matplotlib
Answered By - Trevor Boyd Smith Answer Checked By - Marilyn (WPSolving Volunteer)