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

Method create_artists

lib/matplotlib/legend_handler.py:740–769  ·  view source on GitHub ↗
(self, legend, orig_handle,
                       xdescent, ydescent, width, height, fontsize,
                       trans)

Source from the content-addressed store, hash-verified

738 super().__init__(**kwargs)
739
740 def create_artists(self, legend, orig_handle,
741 xdescent, ydescent, width, height, fontsize,
742 trans):
743 # docstring inherited
744 handler_map = legend.get_legend_handler_map()
745
746 if self._ndivide is None:
747 ndivide = len(orig_handle)
748 else:
749 ndivide = self._ndivide
750
751 if self._pad is None:
752 pad = legend.borderpad * fontsize
753 else:
754 pad = self._pad * fontsize
755
756 if ndivide > 1:
757 width = (width - pad * (ndivide - 1)) / ndivide
758
759 xds_cycle = cycle(xdescent - (width + pad) * np.arange(ndivide))
760
761 a_list = []
762 for handle1 in orig_handle:
763 handler = legend.get_legend_handler(handler_map, handle1)
764 _a_list = handler.create_artists(
765 legend, handle1,
766 next(xds_cycle), ydescent, width, height, fontsize, trans)
767 a_list.extend(_a_list)
768
769 return a_list
770
771
772class HandlerPolyCollection(HandlerBase):

Callers

nothing calls this directly

Calls 3

get_legend_handlerMethod · 0.80
create_artistsMethod · 0.45

Tested by

no test coverage detected