def newfig(*args, **kwargs):
    fig = oldfig(*args, **kwargs)

def clipboard_handler(event):
    if event.key == 'ctrl+c':
        buf = io.BytesIO()
fig.savefig(buf)
QApplication.clipboard().setImage(QImage.fromData(buf.getvalue()))
buf.close()
fig.canvas.mpl_connect('key_press_event', clipboard_handler)
return fig
plt.figure = newfig
add_clipboard_to_figures()
How to add clipboard support to Matplotlib figures?