Parameters ---------- loc : str The box location. Valid locations are 'upper left', 'upper center', 'upper right', 'center left', 'center', 'center right', 'lower left', 'lower center', 'lower right'. For backward
(self, loc, *,
pad=0.4, borderpad=0.5,
child=None, prop=None, frameon=True,
bbox_to_anchor=None,
bbox_transform=None,
**kwargs)
| 930 | } |
| 931 | |
| 932 | def __init__(self, loc, *, |
| 933 | pad=0.4, borderpad=0.5, |
| 934 | child=None, prop=None, frameon=True, |
| 935 | bbox_to_anchor=None, |
| 936 | bbox_transform=None, |
| 937 | **kwargs): |
| 938 | """ |
| 939 | Parameters |
| 940 | ---------- |
| 941 | loc : str |
| 942 | The box location. Valid locations are |
| 943 | 'upper left', 'upper center', 'upper right', |
| 944 | 'center left', 'center', 'center right', |
| 945 | 'lower left', 'lower center', 'lower right'. |
| 946 | For backward compatibility, numeric values are accepted as well. |
| 947 | See the parameter *loc* of `.Legend` for details. |
| 948 | pad : float, default: 0.4 |
| 949 | Padding around the child as fraction of the fontsize. |
| 950 | borderpad : float or (float, float), default: 0.5 |
| 951 | Padding between the offsetbox frame and the *bbox_to_anchor*. |
| 952 | If a float, the same padding is used for both x and y. |
| 953 | If a tuple of two floats, it specifies the (x, y) padding. |
| 954 | |
| 955 | .. versionadded:: 3.11 |
| 956 | The *borderpad* parameter now accepts a tuple of (x, y) paddings. |
| 957 | child : `.OffsetBox` |
| 958 | The box that will be anchored. |
| 959 | prop : `.FontProperties` |
| 960 | This is only used as a reference for paddings. If not given, |
| 961 | :rc:`legend.fontsize` is used. |
| 962 | frameon : bool |
| 963 | Whether to draw a frame around the box. |
| 964 | bbox_to_anchor : `.BboxBase`, 2-tuple, or 4-tuple of floats |
| 965 | Box that is used to position the legend in conjunction with *loc*. |
| 966 | bbox_transform : None or :class:`matplotlib.transforms.Transform` |
| 967 | The transform for the bounding box (*bbox_to_anchor*). |
| 968 | **kwargs |
| 969 | All other parameters are passed on to `.OffsetBox`. |
| 970 | |
| 971 | Notes |
| 972 | ----- |
| 973 | See `.Legend` for a detailed description of the anchoring mechanism. |
| 974 | """ |
| 975 | super().__init__(**kwargs) |
| 976 | |
| 977 | self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform) |
| 978 | self.set_child(child) |
| 979 | |
| 980 | if isinstance(loc, str): |
| 981 | loc = _api.getitem_checked(self.codes, loc=loc) |
| 982 | |
| 983 | self.loc = loc |
| 984 | self.borderpad = borderpad |
| 985 | self.pad = pad |
| 986 | |
| 987 | if prop is None: |
| 988 | self.prop = FontProperties(size=mpl.rcParams["legend.fontsize"]) |
| 989 | else: |
nothing calls this directly
no test coverage detected