@@ -786,12 +786,12 @@ def update_from_data(self, x, y, ignore=None):
786786 xy = np .hstack ((x .reshape ((len (x ), 1 )), y .reshape ((len (y ), 1 ))))
787787 return self .update_from_data_xy (xy , ignore )
788788
789- def update_from_data_xy (self , xy , ignore = None ):
789+ def update_from_path (self , path , ignore = None ):
790790 """
791791 Update the bounds of the :class:`Bbox` based on the passed in
792792 data.
793793
794- xy : a numpy array of 2D points
794+ path : a Path instance
795795
796796 ignore:
797797 - when True, ignore the existing bounds of the Bbox.
@@ -801,20 +801,33 @@ def update_from_data_xy(self, xy, ignore=None):
801801 if ignore is None :
802802 ignore = self ._ignore
803803
804- if len (xy ) == 0 :
805- return
806- xym = ma .masked_invalid (xy ) # maybe add copy=False
807- if (xym .count (axis = 1 )!= 2 ).all ():
808- return
809-
810804 points , minpos , changed = update_path_extents (
811- Path ( xym ) , None , self ._points , self ._minpos , ignore )
805+ path , None , self ._points , self ._minpos , ignore )
812806
813807 if changed :
814808 self ._points = points
815809 self ._minpos = minpos
816810 self .invalidate ()
817811
812+
813+ def update_from_data_xy (self , xy , ignore = None ):
814+ """
815+ Update the bounds of the :class:`Bbox` based on the passed in
816+ data.
817+
818+ xy: a numpy array of 2D points
819+
820+ ignore:
821+ - when True, ignore the existing bounds of the Bbox.
822+ - when False, include the existing bounds of the Bbox.
823+ - when None, use the last value passed to :meth:`ignore`.
824+ """
825+ if len (xy ) == 0 :
826+ return
827+
828+ path = Path (xy )
829+ self .update_from_path (path , ignore = ignore )
830+
818831 def _set_x0 (self , val ):
819832 self ._points [0 , 0 ] = val
820833 self .invalidate ()
0 commit comments