Issue
I obtain the error:
TimeoutError: Lock error: Matplotlib failed to acquire the following lock file
when I remove the comment # before the command for setting the font. Why? How to correct that, please?
import matplotlib.pyplot as plt
params = {'text.usetex' : True,
'font.size' : 8,
'font.family' : 'lmodern'
}
#plt.rcParams.update(params)
fig, ((ax01, ax02, ax03, ax0), (ax1, ax2, ax3, ax4), (ax5, ax6, ax7, ax8), (ax9, ax10, ax11, ax12)) = plt.subplots(nrows=4, ncols=4, figsize=(12,7))
for ax in [ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9, ax10, ax11, ax12]:
ax.set_xlim(0,1000)
ax.ticklabel_format(useOffset=False)
plt.tight_layout()
plt.show()
Solution
Putting my comment into an answer: it seems like you need to delete your matplotlib cache folder. It can be done within Python with:
import pathlib
import matplotlib as mpl
pathlib.Path.rmdir( mpl.get_cachedir())
And, by the way, you can tidy your axes definition and iteration:
fig, axes = plt.subplots(nrows=4, ncols=4, figsize=(12,7))
for ax in axes.ravel():
ax.set_xlim(0,1000)
ax.ticklabel_format(useOffset=False)
Answered By - Learning is a mess
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.