@@ -710,12 +710,53 @@ def hatch(cls, hatchpattern, density=6):
710
710
return hatch_path
711
711
712
712
_get_path_collection_extents = get_path_collection_extents
713
- def get_path_collection_extents (* args ):
713
+ def get_path_collection_extents (
714
+ master_transform , paths , transforms , offsets , offset_transform ):
714
715
"""
715
- Given a sequence of :class:`Path` objects, returns the bounding
716
- box that encapsulates all of them.
716
+ Given a sequence of :class:`Path` objects,
717
+ :class:`~matplotlib.transforms.Transform` objects and offsets, as
718
+ found in a :class:`~matplotlib.collections.PathCollection`,
719
+ returns the bounding box that encapsulates all of them.
720
+
721
+ *master_transform* is a global transformation to apply to all paths
722
+
723
+ *paths* is a sequence of :class:`Path` instances.
724
+
725
+ *transforms* is a sequence of
726
+ :class:`~matplotlib.transforms.Affine2D` instances.
727
+
728
+ *offsets* is a sequence of (x, y) offsets (or an Nx2 array)
729
+
730
+ *offset_transform* is a :class:`~matplotlib.transforms.Affine2D`
731
+ to apply to the offsets before applying the offset to the path.
732
+
733
+ The way that *paths*, *transforms* and *offsets* are combined
734
+ follows the same method as for collections. Each is iterated over
735
+ independently, so if you have 3 paths, 2 transforms and 1 offset,
736
+ their combinations are as follows:
737
+
738
+ (A, A, A), (B, B, A), (C, A, A)
717
739
"""
718
740
from transforms import Bbox
719
- if len (args [1 ]) == 0 :
741
+ if len (paths ) == 0 :
742
+ raise ValueError ("No paths provided" )
743
+ return Bbox .from_extents (* _get_path_collection_extents (
744
+ master_transform , paths , transforms , offsets , offset_transform ))
745
+
746
+ def get_paths_extents (paths , transforms = []):
747
+ """
748
+ Given a sequence of :class:`Path` objects and optional
749
+ :class:`~matplotlib.transforms.Transform` objects, returns the
750
+ bounding box that encapsulates all of them.
751
+
752
+ *paths* is a sequence of :class:`Path` instances.
753
+
754
+ *transforms* is an optional sequence of
755
+ :class:`~matplotlib.transforms.Affine2D` instances to apply to
756
+ each path.
757
+ """
758
+ from transforms import Bbox , Affine2D
759
+ if len (paths ) == 0 :
720
760
raise ValueError ("No paths provided" )
721
- return Bbox .from_extents (* _get_path_collection_extents (* args ))
761
+ return Bbox .from_extents (* _get_path_collection_extents (
762
+ Affine2D (), paths , transforms , [], Affine2D ()))
0 commit comments