plotly.graph_objs中的饼图标签过多有没有办法减轻这个问题?

问题描述

我正在处理大量数据,其中包含许多不同的标签名称。有没有一种方法可以只显示plotly.graph_objs中饼图的高百分比属性?否则,馅饼看起来会很乱。

import plotly.graph_objs as go

dfServer = df.groupby('App_Func').agg({'Times of alarms' : 'sum'})
dfServer.sort_values(by='Times of alarms',inplace=True,ascending=False)
dfServer_labels = dfServer.index                           
dfServer_values = dfServer['Times of alarms']
cmap = plt.get_cmap('Spectral')
colors = [cmap(i) for i in np.linspace(0,1,8)]
Server_pie = go.Pie(labels=dfServer_labels,values=dfServer_values,hole=0.4,marker=dict(colors=colors,line=dict(color='#FFF',width=2)),showlegend=True,name='Server',textinfo='label+percent')
layout = go.Layout(height = 800,width = 1700,autosize = True,title = 'No. of Alerts From Top 10 Servers In Percentage (Excluding Monitoring Prometheus)'
                   )

fig = go.figure(data =Server_pie,layout = layout,)


pio.show(fig,filename='Servers')

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)