How can I remedy a "load glyph" error when making matplotlib plots with multiprocessing?

Viewed 674

My code is returning the following error when using multiprocessing to generate plots with matplotlib. The code has been simplified. Does anyone know how to remedy?

File "/home/rhh/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_pdf.py", line 2173, in get_text_width_height_descent font.set_text(s, 0.0, flags=LOAD_NO_HINTING) RuntimeError: In set_text: could not load glyph

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
0 Answers
Related