Drawing the canvas does not populate ticklabels on MacOSX backend · Issue #19268 · matplotlib/matplotlib · GitHub
Skip to content

Drawing the canvas does not populate ticklabels on MacOSX backend #19268

Description

@mwaskom

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions