fig = Gcf.get_all_fig_managers()[-1].canvas.figure
image_data = 'data:image/png;base64,%s' % b64encode(print_figure(fig)).decode(
    'utf-8')
Gcf.destroy_fig(fig)
HTML("Foo Bar <br> <img src='%s'> <br> Baz" % image_data)
IPython Notebook: How to combine HTML output and matplotlib figures?