Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions python/src/main/resources/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,13 @@ def show_dataframe(self, df, **kwargs):
#)
body_buf.close(); header_buf.close()

def show_matplotlib(self, p, width="0", height="0", **kwargs):
def show_matplotlib(self, p, width="100%", height="100%", **kwargs):
"""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()


Expand Down