Plotly 直方图文本参数不起作用

问题描述 投票:0回答:0

我有一个直方图,我试图在每个柱上添加计数,

text_auto=True
应该可以工作,但它一直给出一个错误
TypeError: histogram() got an unexpected keyword argument 'text_auto'
。我查看了官方文档,它存在于函数中。

那是我的示例数据:

    index                                           content
1   api-path-removed-without-deprecation             4236
2   request-parameter-removed                        2024
3   request-property-removed                         622
4   api-removed-without-deprecation                  524
5   new-required-request-parameter                   502
6   new-required-request-property                    422
8   response-success-status-removed                  367
9   request-parameter-became-required                351
10  response-body-type-changed                       229
11  response-property-type-changed                   224
12  response-property-enum-value-added               224
13  response-media-type-removed                      212
14  request-parameter-type-changed                   207

这是我的图形代码:

import plotly.express as px
fig = px.histogram(top_content_dropped, x="content", y="index", color_discrete_sequence=['#2E86C1'])

fig.update_xaxes(showline=True, linewidth=1, linecolor='black', mirror=True)
fig.update_yaxes(categoryorder='total ascending',showline=True, linewidth=1, linecolor='black', mirror=True)

fig.update_layout(template='ggplot2',width=1500, height=800)

fig.show()

谁能告诉我哪里出错了,我该如何添加文本?

pandas plotly plotly-python
© www.soinside.com 2019 - 2024. All rights reserved.