Skip to content

fill_between interpolation & nan issue #11781

Closed
@Phlya

Description

@Phlya

The issue was discovered here
deeptools/pyGenomeTracks#37

Basically, when fill_between encounters a NaN in the y values, when interpolate=True it produces a strange output.

This is without interpolation:

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(107).astype(float)
y = np.append(np.zeros((100))+0.01, [0.5, 0.75, 1, np.nan, 1, 0.75, 0.5])

plt.figure(figsize=(20, 5))
plt.fill_between(x, y, interpolate=False)

image

If I turn interpolation on (which I wouldn't expect to do anything in this case, since there are not zero crossings), this is what I get:

plt.figure(figsize=(20, 5))
plt.fill_between(x, y, interpolate=True)

image

Even if I am misunderstanding something about how interpolation is supposed to work, clearly this is not what it should do...

mpl 2.1.2, python 3.5.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions