Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I was surprised that when
Code for reproduction
labels = ["A", "B", "C", "", None] values = [1.0, 2.0, 3.0, 4.0, 5.0] plt.barh(np.arange(len(values)), values, tick_label=labels)
In contrast and as a counterexample from another package, when used as index values,
Alternatively, if I plot using pandas
I get the following plot:
I installed matplotlib via pip in a virtual environment.
If you want the string "None", you should pass it in as such
fwiw I think the situation with labels is pretty awkward: we convert everything to strings, except None (and that change is quite recent (depending on the specific place) -- #10392, #14660). If someone wants to write robust, generic code, they can't rely on that autoconversion unless they know for sure the label can't be None (basically, it's the OP's issue).