3

I have a matplotlib figure that is converted to a png :

enter image description here

figure_new.savefig('figure_new.png', bbox_inches='tight', pad_inches=0

and a styler objectreport_newthat is rendered as a html table :enter image description here

report_html=fo.write(plunge_results[_j].report_new.render())

i use following code to put styler as a HTML table and png image in a HTML file:

data_uri = base64.b64encode(open('figure_new.png', 'rb').read()).decode('utf-8').replace('\n', '')

img_tag = '<img src="data:image/png;base64,{0}">'.format(data_uri)

with open('report_new.html','w') as fo :
    report_html=fo.write(plunge_results[_j].report_new.render())
    report_html=fo.write(img_tag)

result contains a html table and one image below it , what i need is :

put png image side by side of the html table in the same length or inserting image as a column of the HTML table something like this :

enter image description here

chessosapiens
  • 3,159
  • 10
  • 36
  • 58

0 Answers0