Is it possible to plot multiple lines on same subplot or axes using multiprocessing ?
I am trying to achieve some performance improvement. I tried using ProcessPoolExecutor, but it only calls my plotting function once and even than the plot is not displayed. I tried something like this:-
def plot (X,y):
plt.plot(X,y)
X_arr=[x1,x2]
y_arr=[y1,y2]
with ProcessPoolExecutor(max_workers=4) as ex:
ex.map(plot, X_arr,y_arr)
Matplotlib is not thread-safe, and certainly does not coalesce figures from multiple processes. You should ensure that all drawing on a single figure occurs in single thread/process.
Sure, Though matplotlib is not thread safe, but for experimental basis I tried to coalesce multiple plotting on a single axes using threads(ThreadPoolExecutor). Though it worked but gave up for two reasons
Matplotlib is not thread safe.
Threads are not good for cpu intensive work in python.
Any other recommendations on how to increase performance of plotting in matplotlib. ?