亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Plotly Dash - 文本未與圖表對齊

Plotly Dash - 文本未與圖表對齊

ABOUTYOU 2023-09-05 15:42:00
即使我創建了兩個分區,第二個分區中的文本也會顯示在第一個分區中。如下圖所示——我用來制作它的代碼 -###### Runs Distributionshtml.H2("Runs Distributions"),# Histogram of Runs Distributionshtml.Div(    [        html.Div(            [                html.P(                    "We can see that the distribution is right skewed. Many "                    "players makes low or medium runs, while few players makes "                    "lots of runs. The median of this distribution is 126 which "                    "means that 50% of the players makes less than 126 runs and  "                    "50% more than this. 406 is the 90th percentile, meaning 90% "                    "of the players makes less than 406 runs. So, any players who "                    "is making more than 400 runs in a season is really doing well. "                    "They are in the top 10%."                )            ],            style={                "width": "35%",                "display": "inline-block",                "margin-top": "60px",            },        ),        html.Div(            [dcc.Graph(id="runs-dist-plot", figure=runs_dist_plot)],            style={"width": "65%", "float": "right", "display": "inline-block"},        ),    ],    style={"margin": "40px"},),# Kernal density estimation of Runs distributionshtml.Div(    [        html.Div(            [html.P("Gonna Write something.")],            style={                "width": "35%",                "display": "inline-block",                "margin-top": "60px",            },        ),        html.Div(            [dcc.Graph(id="runs-kde-plot", figure=runs_kde_plot)],            style={"width": "65%", "float": "right", "display": "inline-block"},        ),    ],    style={"margin": "40px"},),無法理解為什么會發生這種情況?一種方法是調整第二部分中段落標簽的頁邊距樣式,但我有很多圖表要在這些圖表下面繪制。因此,通過反復試驗來改變每個圖的值將是非常乏味的。有沒有辦法為將來的情節設置一次。
查看完整描述

1 回答

?
慕神8447489

TA貢獻1780條經驗 獲得超1個贊

我在本地使用圖形的一些占位符運行此程序,并且能夠使用第一個分區的高度值將文本與第二個圖形一起下載。您所在的地方:

style={"margin": "40px"},

我改為:

style={"margin": "40px", "height": 500},

如果您想在第二個分區內對齊文本,則需要從框的頂部進行調整。

我處理所有這些問題的首選方法是使用flexbox,但這需要進行更多更改并刪除inline-block您所擁有的,因此我在這里只進行了最小的更改。


查看完整回答
反對 回復 2023-09-05
  • 1 回答
  • 0 關注
  • 120 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號