def get_bboxes_pathcollection(sc, ax):
<EOL><INDENT>transform = sc.get_transform()<EOL>transOffset = sc.get_offset_transform()<EOL>offsets = sc._offsets<EOL>paths = sc.get_paths()<EOL>transforms = sc.get_transforms()<EOL>if not transform.is_affine:<EOL><INDENT>paths = [transform.transform_path_non_affine(p) for p in paths]<EOL>transform = transform.get_affine()<EOL><DEDENT>if not transOffset.is_affine:<EOL><INDENT>offsets = transOffset.transform_non_affine(offsets)<EOL>transOffset = transOffset.get_affine()<EOL><DEDENT>if isinstance(offsets, np.ma.MaskedArray):<EOL><INDENT>offsets = offsets.filled(np.nan)<EOL><DEDENT>bboxes = []<EOL>if len(paths) and len(offsets):<EOL><INDENT>if len(paths) < len(offsets):<EOL><INDENT>paths = [paths[<NUM_LIT:0>]]*len(offsets)<EOL><DEDENT>if len(transforms) < len(offsets):<EOL><INDENT>transforms = [transforms[<NUM_LIT:0>]]*len(offsets)<EOL><DEDENT>for p, o, t in zip(paths, offsets, transforms):<EOL><INDENT>result = get_path_collection_extents(<EOL>transform.frozen(), [p], [t],<EOL>[o], transOffset.frozen())<EOL>bboxes.append(result.inverse_transformed(ax.transData))<EOL><DEDENT><DEDENT>return bboxes<EOL><DEDENT>
Function to return a list of bounding boxes in data coordinates
    for a scatter plot
    Thank you to ImportanceOfBeingErnest
    https://stackoverflow.com/a/55007838/1304161