Skip to content

Saving issue with pdf backend #17599

@ericpre

Description

@ericpre

Bug report

Bug summary

The animated artists are missing when saving a figure with the pdf backend (matplotlib 3.0.0 and more recent). The png backend is working fine.

Code for reproduction

# Paste your code here
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 2 * np.pi, 100)

fig, ax = plt.subplots()

(ln,) = ax.plot(x, np.sin(x), animated=True)
plt.show(block=False)
plt.pause(0.1)

bg = fig.canvas.copy_from_bbox(fig.bbox)
ax.draw_artist(ln)
fig.canvas.blit(fig.bbox)

plt.savefig('Trial.pdf')

Actual outcome

image

Expected outcome
image

Saving using the following works fine:

# This is working fine
from matplotlib.backends.backend_pdf import PdfPages
with PdfPages('Trial.pdf') as pdf:
     pdf.savefig()

Matplotlib version

  • Operating system: linux
  • Matplotlib version: 3.0.0 and above
  • Matplotlib backend (print(matplotlib.get_backend())): 'Qt5Agg'
  • Python version: 3.7.7
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy