Hi
I am trying to create an HTML page consisting of the figures and table created using plotly. I do not want the modebar for the figures. I am using to_html to get the figure’s div.
This is the code I am using:
import plotly.graph_objs as go
trace1 = go.Table(
header=dict(values=['A Scores', 'B Scores']),
cells=dict(values=[[100, 90, 80, 90],
[95, 85, 75, 95]]),
)
trace2 = go.Bar(
x=[1, 2, 3],
y=[4, 5, 6],
xaxis="x1",
yaxis="y1"
)
data1 = [trace1]
fig1 = go.Figure(data = data1)
fig1.update_layout(width=500, height=300)
data2 = [trace2]
fig2 = go.Figure(data = data2)
fig2.update_layout(width=400, height=300)
div1=fig1.to_html(include_plotlyjs=False, full_html=False)
div2=fig2.to_html(include_plotlyjs=False, full_html=False)
html_string = '''
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>dbx Metadata</title>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<h2>Summary</h2>
<div style="display: flex">
<div>
<span>Description here for lorem ipsum</span>
</div>
'''+div1+'''
<h2>Chart1</h2>
'''+div2+'''
</div>
</body>
</html>
'''
text_file = open("report01.html", "w")
text_file.write(html_string)
text_file.close()
This is how the html page look like:
As it can be seen just above the bar diagram the display bar is visible, I want to get rid of it.