bugfix for plot for string x values by boeddeker · Pull Request #18726 · pandas-dev/pandas (original) (raw)

Where should I add a release note? The file where I originally added the note, has completely changed.

Regarding the test, the test also fails local on my machine.
I think the reason is that there is a bug in matplotlib, because the example below does not return the expected plot. get_xticklabels is empty (i.e. all values are Text(0,0,'')), while the plot contains labels.
So maybe a bugfix in matplotlib is recommented, before this PR is merged into pandas.

_, ax = plt.subplots() ax.plot(x, y) ax.set_xticks([1, 2]) # -> x labels: ['', 'a', 'b'] print('xticklabels', list(ax.get_xticklabels())) # xticklabels [Text(0,0,''), Text(0,0,'')] print('xticks', list(ax.get_xticks())) # xticks [1.0, 2.0]

_, ax = plt.subplots() ax.plot(x, y) ax.set_xticks(['b', 'c']) # -> x labels: ['', 'a', 'b'] print('xticklabels', list(ax.get_xticklabels())) # xticklabels [Text(0,0,''), Text(0,0,'')] print('xticks', list(ax.get_xticks())) # xticks [1.0, 2.0]