Return display coordinates for hit testing for "best" positioning. Returns ------- bboxes List of bounding boxes of all patches. lines List of `.Path` corresponding to each line. offsets List of (x, y) offsets of a
(self, renderer)
| 967 | self.legend_handles = handle_list |
| 968 | |
| 969 | def _auto_legend_data(self, renderer): |
| 970 | """ |
| 971 | Return display coordinates for hit testing for "best" positioning. |
| 972 | |
| 973 | Returns |
| 974 | ------- |
| 975 | bboxes |
| 976 | List of bounding boxes of all patches. |
| 977 | lines |
| 978 | List of `.Path` corresponding to each line. |
| 979 | offsets |
| 980 | List of (x, y) offsets of all collection. |
| 981 | """ |
| 982 | assert self.isaxes # always holds, as this is only called internally |
| 983 | bboxes = [] |
| 984 | lines = [] |
| 985 | offsets = [] |
| 986 | for artist in self.parent._children: |
| 987 | if isinstance(artist, Line2D): |
| 988 | lines.append( |
| 989 | artist.get_transform().transform_path(artist.get_path())) |
| 990 | elif isinstance(artist, Rectangle): |
| 991 | bboxes.append( |
| 992 | artist.get_bbox().transformed(artist.get_data_transform())) |
| 993 | elif isinstance(artist, Patch): |
| 994 | lines.append( |
| 995 | artist.get_transform().transform_path(artist.get_path())) |
| 996 | elif isinstance(artist, PolyCollection): |
| 997 | lines.extend(artist.get_transform().transform_path(path) |
| 998 | for path in artist.get_paths()) |
| 999 | elif isinstance(artist, Collection): |
| 1000 | transform, transOffset, hoffsets, _ = artist._prepare_points() |
| 1001 | if len(hoffsets): |
| 1002 | offsets.extend(transOffset.transform(hoffsets)) |
| 1003 | elif isinstance(artist, Text): |
| 1004 | bboxes.append(artist.get_window_extent(renderer)) |
| 1005 | |
| 1006 | return bboxes, lines, offsets |
| 1007 | |
| 1008 | def get_children(self): |
| 1009 | # docstring inherited |
no test coverage detected