使用Plotly库的tickformat属性和d3.format函数,设置x轴和y轴的format为',.0f'。
代码示例如下:
import plotly.graph_objs as go
# generate data
x = [1000, 2000, 3000, 4000]
y = [5000, 6000, 7000, 8000]
# plot data
fig = go.Figure(
    data=[go.Scatter(x=x, y=y)],
    layout=go.Layout(
        xaxis=dict(tickformat=',.0f'),  # 设置x轴的数字格式
        yaxis=dict(tickformat=',.0f')   # 设置y轴的数字格式
    )
)
fig.show()