Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a2258c

Browse files
committed
Update stackplot docs for legend capabilities
The docs now state that creation of a proxy artist is the preferred method for creating legends on stackplots. This is because stackplot creates PolyCollection objects which are not supported by the legend
1 parent 03e0936 commit 6a2258c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/matplotlib/stackplot.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ def stackplot(axes, x, *args, **kwargs):
4343
Returns *r* : A list of
4444
:class:`~matplotlib.collections.PolyCollection`, one for each
4545
element in the stacked area plot.
46+
47+
Note that :class:`~matplotlib.legend.Legend` does not support
48+
:class:`~matplotlib.collections.PolyCollection` objects. To create a
49+
legend on a stackplot, use a proxy artist:
50+
http://matplotlib.org/users/legend_guide.html#using-proxy-artist
4651
"""
4752

4853
if len(args) == 1:

0 commit comments

Comments
 (0)