How can I generate more colors on pie chart matplotlib

前端 未结 3 2115
情歌与酒
情歌与酒 2021-02-13 19:41

I am having more then 40 items to show in my chart. I have only 10 colours that repeatedly are shown on the chart. How can I generate more colors.

plt.pie(f,la         


        
3条回答
  •  春和景丽
    2021-02-13 20:21

    If your pie chart is coming out with grouped chunks of the same colour when utilising the solution above, try changing the colour map from 'Set1' to any map you like from the following link: https://matplotlib.org/examples/color/colormaps_reference.html

    As for randomising the colours, I suggest that you randomise the cs array in the solution above. But that doesn't really give a nice spectrum of colours.

提交回复
热议问题