即使我創建了兩個分區,第二個分區中的文本也會顯示在第一個分區中。如下圖所示——我用來制作它的代碼 -###### 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
您所擁有的,因此我在這里只進行了最小的更改。
添加回答
舉報
0/150
提交
取消