8000 weighted_wiggle stackplot fails when all lines are zero at same x · Issue #6313 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
weighted_wiggle stackplot fails when all lines are zero at same x #6313
Closed
@egpbos

Description

@egpbos

When using stackplot(..., baseline='weighted_wiggle') if all y arrays contain zero at some (interval of) x the plot stops rendering after that zero point.

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(10)
y = np.random.random(10)
y2 = np.random.random(10)
y3 = np.random.random(10)

y[5] = 0
y3[5] = 0

fig, ax = plt.subplots(3,2, figsize=(12,8))

ax[0,0].stackplot(x, y, baseline='sym')
ax[0,1].stackplot(x, y, baseline='weighted_wiggle')
ax[1,0].stackplot(x, y, y2, baseline='sym')
ax[1,1].stackplot(x, y, y2, baseline='weighted_wiggle')
ax[2,0].stackplot(x, y, y3, baseline='sym')
ax[2,1].stackplot(x, y, y3, baseline='weighted_wiggle')

ax[0,0].set_title('sym: no problem')
ax[0,1].set_title('failed: stops after zero `y` (x>4)')
ax[1,1].set_title('success: non-zero `y2` saves the day')
ax[2,1].set_title('failed: stops after zero `y` and `y3` (x>4)')

plt.tight_layout()
plt.show()

I have this issue with Matplotlib 1.5.1, installed via pip, with Python 2.7.10 on Ubuntu Linux 15.10.

< 47DD /div>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0