MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / get_legend_handler

Method get_legend_handler

lib/matplotlib/legend.py:844–867  ·  view source on GitHub ↗

Return a legend handler from *legend_handler_map* that corresponds to *orig_handler*. *legend_handler_map* should be a dictionary object (that is returned by the get_legend_handler_map method). It first checks if the *orig_handle* itself is a key in the

(legend_handler_map, orig_handle)

Source from the content-addressed store, hash-verified

842
843 @staticmethod
844 def get_legend_handler(legend_handler_map, orig_handle):
845 """
846 Return a legend handler from *legend_handler_map* that
847 corresponds to *orig_handler*.
848
849 *legend_handler_map* should be a dictionary object (that is
850 returned by the get_legend_handler_map method).
851
852 It first checks if the *orig_handle* itself is a key in the
853 *legend_handler_map* and return the associated value.
854 Otherwise, it checks for each of the classes in its
855 method-resolution-order. If no matching key is found, it
856 returns ``None``.
857 """
858 try:
859 return legend_handler_map[orig_handle]
860 except (TypeError, KeyError): # TypeError if unhashable.
861 pass
862 for handle_type in type(orig_handle).mro():
863 try:
864 return legend_handler_map[handle_type]
865 except KeyError:
866 pass
867 return None
868
869 def _init_legend_box(self, handles, labels, markerfirst=True):
870 """

Callers 2

_init_legend_boxMethod · 0.95
create_artistsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected