Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: bbox_inches="tight" does not work for writer.grab_frame() #25608

@ougx

Description

@ougx

Bug summary

bbox_inches="tight" will make snowflake movie in the example.

The example runs fine after removing bbox_inches="tight".

Code for reproduction

import matplotlib.pyplot as plt
from matplotlib.animation import FFMpegWriter
import numpy as np

fig, ax = plt.subplots()

moviewriter = FFMpegWriter()

moviewriter.setup(fig, 'movie.mp4', dpi=200)


line = ax.plot([], [])[0]
    
    
x = np.linspace(0,2*np.pi,20)
ax.set(xlim=[0, 2*np.pi], ylim=[-1.1, 1.1])
for t in np.linspace(0,2*np.pi,20):    
    line.set_data(x, np.sin(x-t))
    moviewriter.grab_frame(bbox_inches='tight')
    
moviewriter.finish()

Actual outcome

movie.mp4

Expected outcome

movie.mp4

Additional information

No response

Operating system

No response

Matplotlib Version

3.7.1

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions