问题
import dash
import dash_html_components as html
import dash_core_components as dcc
app = dash.Dash()
app.layout = html.Div([
html.Div([
html.Div(dcc.Graph(id='g1', figure={'data': [{'y': [1, 2, 3]}]}), className="six columns",style={"width": 500, "margin": 0}),
html.Div(dcc.Graph(id='g2', figure={'data': [{'y': [1, 2, 3]}]}), className="six columns",style={"width": 500, "margin": 0}),
], className="row")
])
if __name__ == '__main__':
app.run_server(debug=True)
The above code supposed to be side to side like this:
It supposed to produce and I am looking for
But unfortunately,The above code produce I am getting like this:
回答1:
Got the solution from one of my colleagues
import dash
import dash_html_components as html
import dash_core_components as dcc
app = dash.Dash()
app.layout = html.Div([
html.Div([
html.Div(
dcc.Graph(id='g1',
figure={'data': [{'y': [1, 2, 3]}]}),
className="six columns",
style={"width":500, "margin": 0, 'display': 'inline-block'}
),
html.Div(
dcc.Graph(id='g2',
figure={'data': [{'y': [1, 2, 3]}]}),
className="six columns",
style={"width":500, "margin": 0, 'display': 'inline-block'}
),
], className="row")
])
if __name__ == '__main__':
app.run_server(debug=True)
来源:https://stackoverflow.com/questions/60170645/subplot-side-to-side-in-python-dash