Parameters ---------- parent : `~matplotlib.axes.Axes` or `.Figure` The artist that contains the legend. handles : list of (`.Artist` or tuple of `.Artist`) A list of Artists (lines, patches) to be added to the legend. labels : list
(
self, parent, handles, labels,
*,
loc=None,
numpoints=None, # number of points in the legend line
markerscale=None, # relative size of legend markers vs. original
markerfirst=True, # left/right ordering of legend marker and label
reverse=False, # reverse ordering of legend marker and label
scatterpoints=None, # number of scatter points
scatteryoffsets=None,
prop=None, # properties for the legend texts
fontsize=None, # keyword to set font size directly
labelcolor=None, # keyword to set the text color
# spacing & pad defined as a fraction of the font-size
borderpad=None, # whitespace inside the legend border
labelspacing=None, # vertical space between the legend entries
handlelength=None, # length of the legend handles
handleheight=None, # height of the legend handles
handletextpad=None, # pad between the legend handle and text
borderaxespad=None, # pad between the Axes and legend border
columnspacing=None, # spacing between columns
ncols=1, # number of columns
mode=None, # horizontal distribution of columns: None or "expand"
fancybox=None, # True: fancy box, False: rounded box, None: rcParam
shadow=None,
title=None, # legend title
title_fontsize=None, # legend title font size
framealpha=None, # set frame alpha
edgecolor=None, # frame patch edgecolor
facecolor=None, # frame patch facecolor
linewidth=None, # frame patch linewidth
bbox_to_anchor=None, # bbox to which the legend will be anchored
bbox_transform=None, # transform for the bbox
frameon=None, # draw frame
handler_map=None,
title_fontproperties=None, # properties for the legend title
alignment="center", # control the alignment within the legend box
ncol=1, # synonym for ncols (backward compatibility)
draggable=False # whether the legend can be dragged with the mouse
)
| 373 | |
| 374 | @_docstring.interpd |
| 375 | def __init__( |
| 376 | self, parent, handles, labels, |
| 377 | *, |
| 378 | loc=None, |
| 379 | numpoints=None, # number of points in the legend line |
| 380 | markerscale=None, # relative size of legend markers vs. original |
| 381 | markerfirst=True, # left/right ordering of legend marker and label |
| 382 | reverse=False, # reverse ordering of legend marker and label |
| 383 | scatterpoints=None, # number of scatter points |
| 384 | scatteryoffsets=None, |
| 385 | prop=None, # properties for the legend texts |
| 386 | fontsize=None, # keyword to set font size directly |
| 387 | labelcolor=None, # keyword to set the text color |
| 388 | |
| 389 | # spacing & pad defined as a fraction of the font-size |
| 390 | borderpad=None, # whitespace inside the legend border |
| 391 | labelspacing=None, # vertical space between the legend entries |
| 392 | handlelength=None, # length of the legend handles |
| 393 | handleheight=None, # height of the legend handles |
| 394 | handletextpad=None, # pad between the legend handle and text |
| 395 | borderaxespad=None, # pad between the Axes and legend border |
| 396 | columnspacing=None, # spacing between columns |
| 397 | |
| 398 | ncols=1, # number of columns |
| 399 | mode=None, # horizontal distribution of columns: None or "expand" |
| 400 | |
| 401 | fancybox=None, # True: fancy box, False: rounded box, None: rcParam |
| 402 | shadow=None, |
| 403 | title=None, # legend title |
| 404 | title_fontsize=None, # legend title font size |
| 405 | framealpha=None, # set frame alpha |
| 406 | edgecolor=None, # frame patch edgecolor |
| 407 | facecolor=None, # frame patch facecolor |
| 408 | linewidth=None, # frame patch linewidth |
| 409 | |
| 410 | bbox_to_anchor=None, # bbox to which the legend will be anchored |
| 411 | bbox_transform=None, # transform for the bbox |
| 412 | frameon=None, # draw frame |
| 413 | handler_map=None, |
| 414 | title_fontproperties=None, # properties for the legend title |
| 415 | alignment="center", # control the alignment within the legend box |
| 416 | ncol=1, # synonym for ncols (backward compatibility) |
| 417 | draggable=False # whether the legend can be dragged with the mouse |
| 418 | ): |
| 419 | """ |
| 420 | Parameters |
| 421 | ---------- |
| 422 | parent : `~matplotlib.axes.Axes` or `.Figure` |
| 423 | The artist that contains the legend. |
| 424 | |
| 425 | handles : list of (`.Artist` or tuple of `.Artist`) |
| 426 | A list of Artists (lines, patches) to be added to the legend. |
| 427 | |
| 428 | labels : list of str |
| 429 | A list of labels to show next to the artists. The length of handles |
| 430 | and labels should be the same. If they are not, they are truncated |
| 431 | to the length of the shorter list. |
| 432 |
no test coverage detected