问题描述
我正在尝试在破折号应用程序中修复图形大小,以便它是所需的大小,并且在调整浏览器页面大小时不会更改。
我的图形和破折号应用程序的代码如下:
@H_502_5@distplot = ff.create_distplot(hist_data,group_labels,bin_size=50000,show_hist=False) distplot = distplot.update_layout( title_text='Kernel Density Plot of House Price Data',title_x=0.5,xaxis_showgrid=False,yaxis_showgrid=False,hoverlabel=dict(font_size=10,bgcolor='rgb(69,95,154)'),legend=dict(title='Year of data',x=1,y=1,traceorder='normal',xanchor = 'auto') ) #Dash application external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] ##Creating Dash server ## app = dash.Dash(__name__,external_stylesheets=external_stylesheets) app.config.suppress_callback_exceptions=True url_bar_and_content_div = html.Div([ dcc.Location(id='url',refresh=False),html.Div(id='page-content',style={'font': 'Georgia,sans-serif'}) ] ) layout_index = html.Div([ html.H1('Webpage @R_944_4045@ion',style={'textAlign': 'center'}),html.H2('distplot',style={'font-size': '40px'}),html.Br(),dcc.Graph(id='distplot',figure=distplot),],style={'margin-top': '20px','margin-bottom': '20px','margin-right': '80px','margin-left': '80px'} ) ## Creating HTML style ## # index layout app.layout = url_bar_and_content_div # "complete" layout app.validation_layout = html.Div([ url_bar_and_content_div,layout_index ]) # Index callbacks @app.callback(Output('page-content','children'),[Input('url','pathname')]) def display_page(pathname): return layout_index ## Run ## if __name__ == '__main__': app.run_server(debug=True)
我尝试了几种方法来实现此目的,首先将图形放在自己的@H_502[email protected]()中,然后使用@H_502_5@style{'height' : '700','width' : '700' },但它没有用。我尝试将@H_502_5@style直接用于@H_502[email protected]对象,但这也没有用。
有人知道我会怎么做吗?谢谢
编辑 现在,我可以在@H_502_5@height=700方法中使用@H_502[email protected]_layout()来正确设置图形高度的大小。但是,调整我的浏览窗口大小时,图形会重新缩放并错误地将大小更改为浏览器窗口大小。
如果有人知道该怎么做,将不胜感激。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)