拉丁的传说
如果您使用px.bar生成颜色条的设置,请使用:fig.layout.coloraxis.colorbar.title = 'another title'阴谋:完整代码:import plotly.express as pxdata = px.data.gapminder()data_canada = data[data.country == 'Canada']fig = px.bar(data_canada, x='year', y='pop', hover_data=['lifeExp', 'gdpPercap'], color='lifeExp', labels={'pop':'population of Canada'}, height=400)fig.layout.coloraxis.colorbar.title = 'another title'fig.show()