implement matplotlib writing images from running code, fetch and display using base64