diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index 20d4a76e0db3..c31a3c852aca 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -1225,7 +1225,15 @@ def _parse_legend_args(axs, *args, handles=None, labels=None, **kwargs): # if got both handles and labels as kwargs, make same length if handles and labels: - handles, labels = zip(*zip(handles, labels)) + lengthOfHandles = [] + lengthOfLabels = [] + lengthOfHandles, LengthOfLabels = _get_legend_handles_labels(axs, handlers) + if len(lengthOfHandles) != len(lengthOfLabels): + log.warning("The amount of labels do not match the number of legends." + "Please note that they have to be the same size in order to" + "produce accurate graph representations.") + else: + handles, labels = zip(*zip(handles, labels)) elif handles is not None and labels is None: labels = [handle.get_label() for handle in handles] 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