code: def send_fig(fig,name):
  	
  	imgdata = StringIO.StringIO()
  	fig.savefig(imgdata, format='png')
  	imgdata.seek(0)  # rewind the data
  	uri = 'data:image/png;base64,' + urllib.quote(b64encode(imgdata.buf))
  	send_action("update_plot",params={"src":uri, "name":name})
docs: sends figure to frontend