@@ -901,30 +901,26 @@ def _calc_extents_from_path(self, path, ignore, updatex=True, updatey=True):
901
901
minpos : (2,) array
902
902
changed : bool
903
903
"""
904
+ if not (updatex or updatey ):
905
+ return points ,minpos ,False
906
+
904
907
if ignore :
905
908
points = np .array ([[np .inf ,np .inf ], [- np .inf ,- np .inf ]])
906
909
minpos = np .array ([np .inf ,np .inf ])
907
910
else :
908
911
points = self ._points .copy ()
909
912
minpos = self ._minpos .copy ()
910
913
911
- if updatex and updatey :
912
- where = (np .isfinite (path .vertices [...,0 ])
913
- & np .isfinite (path .vertices [...,1 ]))
914
- elif updatex :
915
- where = np .isfinite (path .vertices [...,0 ])
916
- elif updatey :
917
- where = np .isfinite (path .vertices [...,1 ])
918
- else :
919
- return points ,minpos ,False
914
+ valid_points = (np .isfinite (path .vertices [...,0 ])
915
+ & np .isfinite (path .vertices [...,1 ]))
920
916
921
917
if updatex :
922
- x = path .vertices [...,0 ][where ]
918
+ x = path .vertices [...,0 ][valid_points ]
923
919
points [0 ,0 ]= min (points [0 ,0 ],np .min (x ,initial = np .inf ))
924
920
points [1 ,0 ]= max (points [1 ,0 ],np .max (x ,initial = - np .inf ))
925
921
minpos [0 ]= min (minpos [0 ],np .min (x [x > 0 ],initial = np .inf ))
926
922
if updatey :
927
- y = path .vertices [...,1 ][where ]
923
+ y = path .vertices [...,1 ][valid_points ]
928
924
points [0 ,1 ]= min (points [0 ,1 ],np .min (y ,initial = np .inf ))
929
925
points [1 ,1 ]= max (points [1 ,1 ],np .max (y ,initial = - np .inf ))
930
926
minpos [1 ]= min (minpos [1 ],np .min (y [y > 0 ],initial = np .inf ))
@@ -949,9 +945,7 @@ def update_from_data_x(self, x, ignore=None):
949
945
- When ``None``, use the last value passed to :meth:`ignore`.
950
946
"""
951
947
x = np .ravel (x )
952
- xy = np .empty ((x .size ,2 ),dtype = x .dtype )
953
- xy [:,0 ]= x
954
- self .update_from_data_xy (xy ,ignore = ignore ,updatey = False )
948
+ self .update_from_data_xy (np .array ([x ,x ]).T ,ignore = ignore ,updatey = False )
955
949
956
950
def update_from_data_y (self ,y ,ignore = None ):
957
951
"""
@@ -969,9 +963,7 @@ def update_from_data_y(self, y, ignore=None):
969
963
- When ``None``, use the last value passed to :meth:`ignore`.
970
964
"""
971
965
y = np .ravel (y )
972
- xy = np .empty ((y .size ,2 ),dtype = y .dtype )
973
- xy [:,1 ]= y
974
- self .update_from_data_xy (xy ,ignore = ignore ,updatex = False )
966
+ self .update_from_data_xy (np .array ([y ,y ]).T ,ignore = ignore ,updatex = False )
975
967
976
968
def update_from_data_xy (self ,xy ,ignore = None ,updatex = True ,updatey = True ):
977
969
"""