Bug fix in show_matplotlib

This commit is contained in:
Paul Bustios 2016-08-02 17:55:56 -03:00
parent 6f867ceb0c
commit 3e0ef22121

View file

@ -166,16 +166,9 @@ class PyZeppelinContext(object):
"""Matplotlib show function
"""
img = io.StringIO()
p.savefig(img, format='svg')
img.seek(0)
style = ""
if (width != "0"):
style += 'width:' + width
if (height != "0"):
if (len(style) != 0):
style += ","
style += 'height:' + height
print("%html <div style='" + style + "'>" + img.read() + "<div>")
p.savefig(img, format="svg")
html = "%html <div style='width:{width};height:{height}'>{image}<div>"
print(html.format(width=width, height=height, image=img.getvalue()))
img.close()