Suppose we read some data in a pandas data frame:
data1 = pd.read_csv("data.csv", "\t")
The content is as follows:

And then define a function that should give us a horizontal histogram, where the stroke lengths represent the values ββand the bars are marked with keys.
def barchart(data, labels): pos = arange(len(data))+.5
Then we call the chart function as follows:
barchart(data1["val"], data1["key"])
which gives us the following graph:

Now, what determines the order of the bars?
Suppose we want the bars to be in a special order, say [C, A, D, F, E, B] , how can we ensure this?
source share