nschloe / matplotx

:bar_chart: More styles and useful extensions for Matplotlib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adapt `line_labels` for `PolyCollections`

RemDelaporteMathurin opened this issue · comments

I'm keen on making a PR to adapt line_labels to make it work with fill_between objects (PolyCollection)

This would be the usage and output:

import matplotlib.pyplot as plt
import matplotx
import numpy as np

x = np.linspace(0, 1)
y1 = np.linspace(1, 2)
y2 = np.linspace(2, 4)

plt.fill_between(x, y1, label="label1")
plt.fill_between(x, y1, y2, label="label1")

matplotx.label_fillbetween()
plt.show()

image

@nschloe would you be interested in this feature?