@@ -180,10 +180,10 @@ def set_3d_properties(self, z=0, zdir='z', axlim_clip=False):
180
180
def draw (self , renderer ):
181
181
if self ._axlim_clip :
182
182
mask = _viewlim_mask (self ._x , self ._y , self ._z , self .axes )
183
- pos3d = np .ma . array (( self ._x , self ._y , self ._z ),
184
- dtype = float , mask = mask ). filled ( np .nan )
183
+ pos3d = np .array ([ self ._x , self ._y , self ._z ], dtype = float )
184
+ pos3d [ mask ] = np .nan
185
185
else :
186
- pos3d = np .asanyarray ([self ._x , self ._y , self ._z ])
186
+ pos3d = np .array ([self ._x , self ._y , self ._z ])
187
187
188
188
proj = proj3d ._proj_trans_points ([pos3d , pos3d + self ._dir_vec ], self .axes .M )
189
189
dx = proj [0 ][1 ] - proj [0 ][0 ]
@@ -465,7 +465,8 @@ def do_3d_projection(self):
465
465
self .axes )
466
466
if np .any (viewlim_mask ):
467
467
# broadcast mask to 3D
468
- viewlim_mask = viewlim_mask [..., np .newaxis ].repeat (3 , axis = - 1 )
468
+ viewlim_mask = np .broadcast_to (viewlim_mask [..., np .newaxis ],
469
+ (* viewlim_mask .shape , 3 ))
469
470
mask = mask | viewlim_mask
470
471
xyzs = np .ma .array (proj3d ._proj_transform_vectors (segments , self .axes .M ),
471
472
mask = mask )
@@ -1100,8 +1101,8 @@ def _get_vector(self, segments3d):
1100
1101
"""
1101
1102
if isinstance (segments3d , np .ndarray ):
1102
1103
if segments3d .ndim != 3 or segments3d .shape [- 1 ] != 3 :
1103
- raise ValueError ("segments3d must be a MxNx3 array, but got " +
1104
- "shape {}" . format ( segments3d .shape ) )
1104
+ raise ValueError ("segments3d must be a MxNx3 array, but got "
1105
+ f "shape { segments3d .shape } " )
1105
1106
if isinstance (segments3d , np .ma .MaskedArray ):
1106
1107
self ._faces = segments3d .data
1107
1108
self ._invalid_vertices = segments3d .mask .any (axis = - 1 )
@@ -1117,8 +1118,6 @@ def _get_vector(self, segments3d):
1117
1118
segments [i , :len (face )] = face
1118
1119
self ._faces = segments
1119
1120
self ._invalid_vertices = np .arange (max_verts ) >= num_verts [:, None ]
1120
- assert self ._invalid_vertices is False or \
1121
- self ._invalid_vertices .shape == self ._faces .shape [:- 1 ]
1122
1121
1123
1122
def set_verts (self , verts , closed = True ):
1124
1123
"""
@@ -1184,11 +1183,7 @@ def do_3d_projection(self):
1184
1183
needs_masking = np .any (self ._invalid_vertices )
1185
1184
num_faces = len (self ._faces )
1186
1185
mask = self ._invalid_vertices
1187
-
1188
- # Some faces might contain masked vertices, so we want to ignore any
1189
- # errors that those might cause
1190
- with np .errstate (invalid = 'ignore' , divide = 'ignore' ):
1191
- pfaces = proj3d ._proj_transform_vectors (self ._faces , self .axes .M )
1186
+ pfaces = proj3d ._proj_transform_vectors (self ._faces , self .axes .M )
1192
1187
1193
1188
if self ._axlim_clip :
1194
1189
viewlim_mask = _viewlim_mask (self ._faces [..., 0 ], self ._faces [..., 1 ],
0 commit comments