I am trying to plot multiple graphs in dash.I obtained a code from SO.Plese see the link below
Multiple plotly plots on 1 page without subplot
When I am running the same code which is selected as answer here,I am getting an error.
NameError: name 'col_style' is not defined
Please see the code below.May I know here I went wrong
import plotly.offline as pyo
import plotly.graph_objs as go
import plotly as py
import dash
import dash_core_components as dcc
import dash_html_components as html
fig1 = go.Scatter(y=[1,2,3])
fig2 = go.Scatter(y=[3,2,1])
plots = [fig1, fig2]
app = dash.Dash()
layout = html.Div(
[html.Div(plots[i], style=col_style[i]) for i in range(len(plots))],
style = {'margin-right': '0px'}
)
app.layout = layout
app.run_server()
My Code currently I using for plotting 10 Images
app = dash.Dash()
app.layout = html.Div([
html.Div(html.H1(children="TEST SUIT1"),style={'textAlign': 'center','color': '#5742f5', 'fontSize': 20}),
dcc.Graph(
id = 'graph1',
figure=fig),
dcc.Graph(
id = 'graph2',
figure=fig1),
dcc.Graph(
id = 'graph3',
figure=fig2),
dcc.Graph(
id = 'graph4',
figure=fig3),
dcc.Graph(
id = 'graph5',
figure=fig4),
dcc.Graph(
id = 'graph6',
figure=fig5),
dcc.Graph(
id = 'graph7',
figure=fig6),
dcc.Graph(
id = 'graph8',
figure=fig7),
dcc.Graph(
id = 'graph9',
figure=fig8)
])
if __name__ == '__main__':
app.run_server()
Output I am getting after making the changes suggested by HLZL.I am getting an empty html file without any graph.
Dash is running on http://127.0.0.1:8050/
* Serving Flask app "__main__" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
127.0.0.1 - - [29/Jun/2021 20:11:13] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [29/Jun/2021 20:11:13] "GET /_dash-layout HTTP/1.1" 200 -
127.0.0.1 - - [29/Jun/2021 20:11:13] "GET /_dash-dependencies HTTP/1.1" 200