I tried using the New Times New Roman font instead of the Bitstream vera sans font , which is used by default for matplotlib on the school network server.
I get the following error with Times or Helvetica , or Arial .
not found error
To solve this problem, I asked for technical assistance to upload these fonts to the server. I confirmed that they have been downloaded.
Now after removing fontList.cache and re-running the code as shown below:
import matplotlib.pyplot as plt import numpy as np x= np.arange(0,100) y= 3*x-1 plt.plot(x,y) plt.xlabel('x',fontdict={"name": "Times New Roman"}) plt.ylabel('y',fontdict={"name": "Times New Roman"}) plt.show()
It's good that I no longer see the error message, but the bad thing is that after adding fontdict={"name": "Times New Roman"}, label disappeared.
I can not find the reason for this without any error.
Isaac source share