Draw not caching with macosx backend · Issue #7550 · matplotlib/matplotlib · GitHub
Skip to content

Draw not caching with macosx backend #7550

Description

@matthew-brett

Using local install of current git master - the following code works with the tkagg backend, but raises an error with the macosx backend:

import matplotlib
matplotlib.use('macosx')
import matplotlib.pyplot as plt

fig, ax = plt.subplots(1, 1)
im = plt.imshow([[1, 2], [3, 4]])
fig.canvas.draw()
ax.draw_artist(im)

Error for macosx backend is:


Traceback (most recent call last):
  File "draw_artist.py", line 8, in <module>
    ax.draw_artist(im)
  File "/Users/mb312/dev_trees/matplotlib/lib/matplotlib/axes/_base.py",
line 2423, in draw_artist
    raise AttributeError(msg)
AttributeError: draw_artist can only be used after an initial draw
which caches the render

It seems to me that the previous call fig.canvas.draw() is the "initial draw" that should cache the renderer. So, is this a bug?

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