Skip to content

Matplotlib animations are clipped #4975

@jenssss

Description

@jenssss

ALL software version info

holoviews 1.14.4 pyhd3eb1b0_1
matplotlib 3.3.4 py39h06a4308_0
python 3.9.5 h12debd9_4
Ubuntu 20.04.2 LTS

Description of expected behavior and the observed behavior

When plotting an animation with the matplotlib backend, the edges of the figure are clipped. This happens for both gif and webm animations. When saving the same figure to a static figure such as png, the edges are not clipped.

Complete, minimal, self-contained example code that reproduces the issue

import holoviews as hv
import numpy as np

hv.extension("matplotlib")

frequencies = np.linspace(0.5, 0.6, 5)

def sine_curve(phase, freq):
    xvals = [0.1* i for i in range(100)]
    return hv.Curve((xvals, [np.sin(phase+freq*x) for x in xvals]))

curve_dict = {f:sine_curve(0,f) for f in frequencies}
hmap = hv.HoloMap(curve_dict, kdims='frequency')

hv.save(hmap, 'sines.webm', fmt='webm')
hv.save(hmap, 'sines.gif', fmt='gif', fps=5)
hv.save(hmap, 'sines.png', fmt='png')

layout = hmap + hmap
hv.save(layout, 'sines_layout.webm', fmt='webm')
hv.save(layout, 'sines_layout.gif', fmt='gif', fps=5)
hv.save(layout, 'sines_layout.png', fmt='png')

Screenshots or screencasts of the bug in action

sines.png file showing no clipping
sines
sines.gif files showing clipping of the y-label, and a wide right margin
sines

Same as above for a layout. Here the clipping is even more clear, affecting the title in addition to the left and lower margins
sines_layout

sines_layout

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't correct or isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions