def _repr_html_(self):
"""Return an html representation of the plot object. Will display as a
png for each WindowPlotMPL instance in self.plots"""
ret = ''
unique = set(self.plots.values())
if len(unique) < len(self.plots):
iters = izip(range(len(unique)), sorted(unique))
else:
iters = iteritems(self.plots)
for uid, plot in iters:
with matplotlib_style_context():
img = plot._repr_png_()
img = base64.b64encode(img).decode()
ret += r'<img style="max-width:100%%;max-height:100%%;" ' \
r'src="data:image/png;base64,{0}"><br>'.format(img)
return ret
评论列表
文章目录