Skip to content

fill_between incorrect with log y-axis and value 0 #8623

@cdeil

Description

@cdeil

fill_between doesn't give the result I expect if using a log y-axis and having a value of 0 in the y1 array.

Example:

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

x = np.array([1, 2, 3, 4, 5])
y1 = np.array([9, 2, 8, 3, 0])
y2 = np.array([10, 10, 10, 10, 10])

plt.plot(x, y1, lw=3, color='green')
plt.plot(x, y2, lw=3, color='red')
plt.fill_between(x, y1, y2)
plt.loglog()

Actual outcome:

The polygon created by fill_between somehow connects the last and first point, resulting in a completely incorrect patch:

image

Expected outcome

I was expecting / hoping that the band would be filled correctly and simply clipped (i.e. the result I get when changing the last y1 value from 0 to e.g. 1e-10). In the plot, the blue fill should be between the red and green line.

Matplotlib version

This is with Matplotlib 2.0.0.
(on Macports, but I don't think that matters)

Metadata

Metadata

Assignees

No one assigned

    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