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

Method create_artists

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

Source from the content-addressed store, hash-verified

283 """
284
285 def create_artists(self, legend, orig_handle,
286 xdescent, ydescent, width, height, fontsize,
287 trans):
288 # docstring inherited
289 xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
290 width, height, fontsize)
291
292 markevery = None
293 if self.get_numpoints(legend) == 1:
294 # Special case: one wants a single marker in the center
295 # and a line that extends on both sides. One will use a
296 # 3 points line, but only mark the #1 (i.e. middle) point.
297 xdata = np.linspace(xdata[0], xdata[-1], 3)
298 markevery = [1]
299
300 ydata = np.full_like(xdata, (height - ydescent) / 2)
301 legline = Line2D(xdata, ydata, markevery=markevery)
302
303 self.update_prop(legline, orig_handle, legend)
304
305 if legend.markerscale != 1:
306 newsz = legline.get_markersize() * legend.markerscale
307 legline.set_markersize(newsz)
308
309 legline.set_transform(trans)
310
311 return [legline]
312
313
314class HandlerPatch(HandlerBase):

Callers

nothing calls this directly

Calls 7

get_markersizeMethod · 0.95
set_markersizeMethod · 0.95
set_transformMethod · 0.95
Line2DClass · 0.90
get_xdataMethod · 0.45
get_numpointsMethod · 0.45
update_propMethod · 0.45

Tested by

no test coverage detected