我将matplotlib与多处理结合使用,可以快速制作出许多图形。问题是某些数字的标题中的文本弄乱了。
有没有其他人遇到过这个问题,有没有办法防止它发生呢?
作为参考,我在此答案中使用该方法来制作数字:https://stackoverflow.com/a/40032128/2383070
def make_plot(d):
plt.cla()
plt.clf()
d1 = np.random.rand(10,10)*d
d2 = np.random.rand(10,10)*d
d3 = np.random.rand(10,10)*d
figs, (ax1, ax2, ax3) = plt.subplots(1,3, figsize=(20,10))
plt.sca(ax1)
plt.title('A title for d1')
plt.pcolormesh(d1, vmin=0, vmax=1)
plt.sca(ax2)
plt.title('A title for d2')
plt.pcolormesh(d2, vmin=0, vmax=1)
plt.sca(ax3)
plt.title('A title for d3')
plt.pcolormesh(d3, vmin=0, vmax=1)
plt.savefig('./%s' % d)
p = multiprocessing.Pool(10)
p.map(make_plot, range(30))