@@ -2040,6 +2040,7 @@ def cycle_changer(
2040
2040
label = None , labels = None , values = None ,
2041
2041
legend = None , legend_kw = None ,
2042
2042
colorbar = None , colorbar_kw = None ,
2043
+ errobjs = None ,
2043
2044
** kwargs
2044
2045
):
2045
2046
"""
@@ -2088,6 +2089,9 @@ def cycle_changer(
2088
2089
colorbar_kw : dict-like, optional
2089
2090
Ignored if `colorbar` is ``None``. Extra keyword args for our call
2090
2091
to `~proplot.axes.Axes.colorbar`.
2092
+ errobjs : `~matplotlib.artist.Artist` or list thereof, optional
2093
+ Error bar objects to add to the legend. This is used internally and
2094
+ should not be necessary for users. See `indicate_error`.
2091
2095
2092
2096
Other parameters
2093
2097
----------------
@@ -2318,11 +2322,14 @@ def cycle_changer(
2318
2322
2319
2323
# Add legend
2320
2324
if legend :
2321
- # Add handles
2325
+ # Add handles and error objects
2322
2326
loc = self ._loc_translate (legend , 'legend' , allow_manual = False )
2323
2327
if loc not in self ._auto_legend :
2324
2328
self ._auto_legend [loc ] = ([], {})
2325
2329
self ._auto_legend [loc ][0 ].extend (objs )
2330
+ if type (errobjs ) not in (list , tuple ):
2331
+ errobjs = (errobjs ,)
2332
+ self ._auto_legend [loc ][0 ].extend (obj for obj in errobjs if obj is not None )
2326
2333
# Add keywords
2327
2334
if loc != 'fill' :
2328
2335
legend_kw .setdefault ('loc' , loc )
0 commit comments