Skip to content

Instantly share code, notes, and snippets.

@gerritjandebruin
Created May 12, 2021 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerritjandebruin/4cb74d371e84237d48183f79dba8fd05 to your computer and use it in GitHub Desktop.
Save gerritjandebruin/4cb74d371e84237d48183f79dba8fd05 to your computer and use it in GitHub Desktop.
Plot hip and plotly to a webpage
html = hip.Experiment.from_iterable(df.to_dict(orient='records')).to_html()
soup = BeautifulSoup(html, 'html.parser')
tag1 = soup.new_tag('div', attrs={'margin-left': 'auto', 'margin-right': 'auto'})
tag1.append(BeautifulSoup(fig1.to_html(include_plotlyjs='cdn', full_html=False)))
soup.body.insert(0, tag1)
tag2 = soup.new_tag('div', attrs={'margin-left': 'auto', 'margin-right': 'auto'})
tag2.append(BeautifulSoup(fig2.to_html(include_plotlyjs='cdn', full_html=False)))
soup.body.insert(1, tag2)
with open('docs/run3.html', 'w') as file:
file.write(str(soup))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment