Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Artifacts in PlotnineAnimation #816

Closed
AlFontal opened this issue Jul 1, 2024 · 2 comments
Closed

Artifacts in PlotnineAnimation #816

AlFontal opened this issue Jul 1, 2024 · 2 comments
Labels

Comments

@AlFontal
Copy link

AlFontal commented Jul 1, 2024

Whenever an animation of figures containing colorbars is generated and saved via PlotnineAnimation, an artifact with a repeated colorbar, centered at coordinates (0, 0), appears in the animation.

I would create a reproducible example but even the example used in the Plotnine docs shows this issue:

image

In cases like mine, however, it can become more annoying since the colorbar is horizontal and obstructs a part of the choropleth map I am showing:

japan_ndvi_2015

My solution by now is to simply add a bottom margin to the plot and crop out the part with the artifact, but there has to be something in the animation module that causes this behavior that probably should be easy enough to fix?

@has2k1 has2k1 added the bug label Jul 2, 2024
@jeroenjanssens
Copy link
Contributor

I can confirm this. Just want to add that the title and subtitle are not showing up in the animation. Here's one frame:

one_frame

And here's a short animation:

animation.mp4

@jeroenjanssens
Copy link
Contributor

A workaround for this would be to save each frame as an image and then use ffmpeg to stitch those images into a video. For the example in the documentation, that could be something like:

for frame, k in enumerate(np.linspace(kmin, kmax, num_frames)):
    plot(k).save(f"frames/{frame:06}.png")
! ffmpeg -y -framerate 10 -i frames/%06d.png -pix_fmt yuv420p -vcodec libx264 -crf 18 animation.mp4
animation.mp4

@has2k1 has2k1 closed this as completed in 46b1338 Aug 1, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants