使用多处理生成matplotlib图时,我的代码返回以下错误。代码已经简化。有谁知道如何补救?
文件 “/home/rhh/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_pdf.py” 第2173行,在get_text_width_height_descent中 font.set_text(s,0.0,flags = LOAD_NO_HINTING)RuntimeError:在set_text中:无法加载字形
import multiprocessing as mt
import matplotlib.pyplot as plt
import numpy as np
def plot_multi(data1,paths1,data2,paths2):
q1 = mt.Queue();q2 = mt.Queue();
p1=mt.Process(target=fxn,args=(q1,data1,paths1,"s1","s2"))
p2=mt.Process(target=fxn,args=(q2,data2,paths2,"s3","s4"))
p1.start();p2.start();
p1.join();p2.join();
a1=mq1.get()
a2=mq2.get()
return a1,a2
def fxn(oq1,y,ypaths,str1,str2):
plt.clf()
r,c=y.shape
plt.hist(y,int(r/3))
plt.ylabel("Counts")
plt.xlabel("Bins")
plt.title(str2+' Histogram \n Case 1')
plt.savefig("./plots/histograms/"+str2+"_"+str1+"_hist.pdf")
oq1.put((y))
return