根据分类变量更改pyplot的颜色

时间:2019-09-03 06:53:49

标签: python dataframe seaborn

我有一个数据框,其中包含“单位”列(分类并具有3个唯一值),“ unit_flag”(日期),“值”(以米为单位的距离)。 我绘制了一个时间序列图,其中x轴为“ unit_flag”(日期除外),y轴为“ value”。我想按照“单位”更改打印线的颜色

import seaborn as sns
plt.plot(data_new["unit_flag"],data_new["value"])
plt.margins(0.2)
plt.subplots_adjust(bottom=0.15)
plt.show()

如何按照“单位”更改颜色?

其他帖子中给出的解决方案是针对不同条件的

0 个答案:

没有答案
相关问题