【发布时间】:2020-11-18 16:27:37
【问题描述】:
我在条形图的图例部分定义许多颜色时遇到问题。
在完成一些基本过程后,我使用下面显示的代码绘制了一个图形。
ax = df.plot(kind='bar', stacked=True,figsize=(13,10))
plt.title('Title List', fontsize=20)
leg = ax.legend(loc='center right', bbox_to_anchor=(1.3, 0.5), ncol=1)
plt.tight_layout()
plt.savefig('images/image1.png', bbox_inches = "tight")
plt.show()
当我运行代码时,有些颜色是一样的。
如何在图例部分定义独特的颜色?
【问题讨论】:
-
请附上你的输出截图
-
@Divyessh Maheshwari 我附上了图例截图的颜色。
-
所有电源颜色都被占用了。
-
主要有10种颜色
-
@Divyessh Maheshwari 如何将它们定义为独特的
标签: python dataframe plot colors