Subplot ( Side to side ) in python Dash

帅比萌擦擦* 提交于 2021-02-08 11:21:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!