我创建了一个包含15个值的饼图。它可以正确显示,除了某些颜色是重复的以外,这使得很难看到条形图链接了什么值。请参阅下面的当前饼图。
饼图使用的代码是:
import plotly.plotly as py
import plotly.graph_objs as go
plt.figure(figsize=(7,5))
labels = [ 'Anti-social behaviour', 'Bicycle theft', 'Burglary','Criminal damage and arson', 'Drugs', 'Other crime', 'Other theft', 'Possession of weapons', 'Public order', 'Robbery',
'Shoplifting', 'Theft from the person', 'Vehicle crime', 'Violence and sexual offences']
sizes = summergroup **<the df**
patches, texts = plt.pie(sizes)
plt.legend(patches, labels, bbox_to_anchor=(0.93,0.93), loc="upper left")
plt.axis('equal')
plt.tight_layout()
plt.show()
任何人都可以阐明如何使条形图上的所有颜色唯一吗?