[英]Place tick label inside in a Plotly Dash chart - Python
我面临在我的 Plotly Dash 环境中的图表内放置分类刻度标签的问题。
这是应用程序:
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import plotly.express as px
animals = ['giraffes', 'orangutans', 'monkeys']
fig = px.bar(x=[20, 14, 23], y=animals)
fig.update_layout(yaxis={'ticklabelposition': 'inside'})
fig.update_xaxes(range=[0, 50])
chart_bar = dcc.Graph(figure=fig)
app = dash.Dash(__name__,
external_stylesheets=[dbc.themes.BOOTSTRAP],
meta_tags=[{"name": "viewport",
"content": "width=device-width, initial-scale=1"}])
app.layout = html.Div([
dbc.Row([
dbc.Col(children=chart_bar, md=6)],
className='app-body')
],
)
if __name__ == '__main__':
app.run_server(debug=True)
好像yaxis={'ticklabelposition': 'inside'}不工作
如果我在应用程序之外做同样的图表,它工作得很好。 在这里,由完全相同的脚本生成。
似乎某些 Plotly 参数在 Dash 应用程序中不起作用。 还是我错了? 我错过了什么? 有没有办法把标签放在里面,在酒吧里?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.