python Dash中的子图(左右) [英] Subplot ( Side to side ) in python Dash

查看:88
本文介绍了python Dash中的子图(左右)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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:

它应该产生并且我正在寻找

但是不幸的是,上面的代码产生了我得到的是这样的:

But unfortunately,The above code produce I am getting like this:

推荐答案

从我的一位同事那里得到了解决方案

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)

这篇关于python Dash中的子图(左右)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆