Inconsitent index for plot (original) (raw)

Code Sample

import pandas as pd import matplotlib.pyplot as plt

data = {"A":0, "B":3, "C":-4} df = pd.DataFrame.from_dict(data, orient = "index", columns = ["Value"]) ax = df.plot.barh()

df = df.sort_values("Value") * - 2 df.plot.barh(ax = ax, color = "red") plt.show()

Problem description

The second plot overwrites the first index even if it is not in the same order, producing incoherent figure where the ylabel does not match with the data displayed.
The current output (pandas 0.24.1) creates
current
instead of
correct

I don't know if this is related to the way pandas handles index or matplotlib.