@@ -901,17 +901,27 @@ def update_from_path(self, path, ignore=None, updatex=True, updatey=True):
901901
902902 valid_points = (np .isfinite (path .vertices [..., 0 ])
903903 & np .isfinite (path .vertices [..., 1 ]))
904+ if not valid_points .any ():
905+ return
904906
905907 if updatex :
906908 x = path .vertices [..., 0 ][valid_points ]
907- points [0 , 0 ] = min (points [0 , 0 ], np .min (x , initial = np .inf ))
909+ minx = np .min (x , initial = np .inf )
910+ points [0 , 0 ] = min (points [0 , 0 ], minx )
908911 points [1 , 0 ] = max (points [1 , 0 ], np .max (x , initial = - np .inf ))
909- minpos [0 ] = min (minpos [0 ], np .min (x [x > 0 ], initial = np .inf ))
912+ if minx > 0 :
913+ minpos [0 ] = min (minpos [0 ], minx )
914+ else :
915+ minpos [0 ] = min (minpos [0 ], np .min (x [x > 0 ], initial = np .inf ))
910916 if updatey :
911917 y = path .vertices [..., 1 ][valid_points ]
912- points [0 , 1 ] = min (points [0 , 1 ], np .min (y , initial = np .inf ))
918+ miny = np .min (y , initial = np .inf )
919+ points [0 , 1 ] = min (points [0 , 1 ], miny )
913920 points [1 , 1 ] = max (points [1 , 1 ], np .max (y , initial = - np .inf ))
914- minpos [1 ] = min (minpos [1 ], np .min (y [y > 0 ], initial = np .inf ))
921+ if miny > 0 :
922+ minpos [1 ] = min (minpos [1 ], miny )
923+ else :
924+ minpos [1 ] = min (minpos [1 ], np .min (y [y > 0 ], initial = np .inf ))
915925
916926 if np .any (points != self ._points ) or np .any (minpos != self ._minpos ):
917927 self .invalidate ()
0 commit comments