Skip to content

MacOSX does not render frames in which new artists are added when blitting #17445

Closed
@mfosterw

Description

@mfosterw

Bug report

Bug summary

Using FuncAnimation with the MacOSX backend and blitting turned on, every frame in which a new artist or patch is added to the axes is blank, while all other frames render normally. This does not happen with the TkAgg backend, and presumable MacOSX is the only affected backend.

Code for reproduction

from random import random

import matplotlib
matplotlib.use('MacOSX')
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation

fig = plt.figure()
axe = fig.add_axes([0, 0, 1, 1], frameon=False)
circles = []

def update(i):
    if not i % 10:
        new_circle = plt.Circle((random(), random()), 0.05, color='black')
        axe.add_patch(new_circle)
        circles.append(new_circle)

    for circle in circles:
        circle.center = (random(), random())

    return circles

animation = FuncAnimation(fig, update, frames=60, interval=1000/2, repeat=False, blit=True)
plt.show()

Actual outcome

Every 10th frame, when a new circle is added to the axes, the figure is blank; every other frame outputs normally.

Expected outcome

Every frame should render.

Matplotlib version

  • Operating system: macOS Mojave 10.14.6
  • Matplotlib version: 3.2.1
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 3.8.2

Installed using Conda from conda-forge.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions