You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何去除Plotly漏斗图中的异常涂鸦?

问题描述

我尝试调整字体、文本位置(内部/外部)及其他格式选项,但均未解决问题,甚至不清楚这些异常涂鸦是什么。

异常图表

Plotly漏斗图异常

相关代码
import plotly.graph_objs as go
import pandas as pd

marketing_funnel_count = marketing_funnel_count.sort_values('FUNNEL_EVENT_COUNT', ascending=False)

# 计算各阶段的百分比变化
marketing_funnel_count['Percent Change'] = [100.0] + [(marketing_funnel_count['FUNNEL_EVENT_COUNT'][i] / marketing_funnel_count['FUNNEL_EVENT_COUNT'][i-1]) * 100 for i in range(1, len(marketing_funnel_count))]

# 创建漏斗图
fig = go.Figure(go.Funnel(
    y=marketing_funnel_count['FUNNEL_EVENT'],
    x=marketing_funnel_count['FUNNEL_EVENT_COUNT'],
    textposition='inside',
    textinfo='percent previous',
    marker=dict(color=['#FFD700', '#C0C0C0', '#CD7F32', '#800000', '#FFD700', '#C0C0C0']),
    connector=dict(line_color='rgba(0,0,0,0)', line_width=0.1),
    connector_visible=False,
    showlegend=False))

# 添加百分比变化注释
for i in range(len(marketing_funnel_count)):
    fig.add_annotation(x=marketing_funnel_count['FUNNEL_EVENT_COUNT'][i], y=marketing_funnel_count['FUNNEL_EVENT'][i],
                       text=f'{marketing_funnel_count["Percent Change"][i]:.1f}%',
                       showarrow=False)

# 展示图表
fig.show()

内容的提问来源于stack exchange,提问作者Kate

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 09:10:19