I have used \alpha, \lambda etc to label axes in matplotlib, but it seems that \rho is not allowed. Is it because not every Greek letter is allowed? Can I label the x-axis as \rho?
import matplotlib.pyplot as plt
from np.random import normal
plt.figure()
plt.plot(np.linspace(0,10,100), normal(0,1,100), color="darkblue")
plt.xlabel("$\rho$")
plt.ylabel("Values")
plt.show()
You can do it and you must have been really close if you got alpha and lambda to display.
What you missed is the r in front of it. It should look like this:
plt.xlabel(r"$\rho$")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.