pie-chart

How can I generate more colors on pie chart matplotlib

倖福魔咒の 提交于 2021-01-21 03:49:30
问题 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,labels=labels,autopct='%1.1f%%', startangle=90,shadow=True) I should add "color=colors" where colors is generated infinitely ? 回答1: You need colors argument, beside that you can use some color maps from cm . >>> import matplotlib.pyplot as plt >>> from matplotlib import cm >>> import numpy as np >>> a=np.random.random(40) >>> cs=cm.Set1

How can I generate more colors on pie chart matplotlib

柔情痞子 提交于 2021-01-21 03:48:32
问题 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,labels=labels,autopct='%1.1f%%', startangle=90,shadow=True) I should add "color=colors" where colors is generated infinitely ? 回答1: You need colors argument, beside that you can use some color maps from cm . >>> import matplotlib.pyplot as plt >>> from matplotlib import cm >>> import numpy as np >>> a=np.random.random(40) >>> cs=cm.Set1