Closed
Description
Bug report
Bug summary
This is basically the same issue as #6103, but I have found that the "correct" approach selectively fails on the macosx backend. I decided to open a separate issue because there's a lot going on in the original thread.
(BTW I do support the suggestion in the original thread that get_{x/y}ticklabels
should implicitly draw so that it always returns a sensible result).
Code for reproduction
import matplotlib.pyplot as plt
ax = plt.figure().subplots()
ax.plot(["a", "b", "c"], [1, 2, 3])
ax.figure.canvas.draw()
print(ax.get_xticklabels())
Actual outcome
Using the MacOSX backend:
[Text(0, 0, ''), Text(0, 0, ''), Text(0, 0, '')]
Expected outcome
Using an agg-based backend:
[Text(0, 0, 'a'), Text(1, 0, 'b'), Text(2, 0, 'c')]
Matplotlib version
- Operating system:
- Matplotlib version: (
import matplotlib; print(matplotlib.__version__)
) 3.3.3 - Matplotlib backend (
print(matplotlib.get_backend())
): macosx - Python version: 3.8
- Jupyter version (if applicable): n/a
- Other libraries: n/a