更改熊猫情节中图例的顺序

时间:2021-07-21 11:11:17

标签: python pandas legend legend-properties

我一直在尝试更改 Pandas 中图例上图例的顺序,以使其与图出现的顺序相同:

Screenshot of the code and the plot in Anaconda

如您所见,通过增加 %K 的数量,图正在堆叠,我希望图例被反转,以便图更易于阅读。

我真的很感激任何建议

1 个答案:

答案 0 :(得分:0)

可以在循环前调用

$n = str_replace(",", "", $n);
if (!ctype_digit($n)) return false;
$n = (int)$n;

然后在绘图之前

 fig, ax = plt.subplots()

正如它所说的here