@@ -167,8 +167,8 @@ def path_to_3d_segment(path, zs=0, zdir='z'):
167
167
# Pre allocate memory
168
168
seg3d = np .ones ((3 , len (path )))
169
169
170
- # Works either if zs is array or scalar
171
- seg3d [2 ] *= zs
170
+ # Works both if zs is and array and a scalar
171
+ seg3d [2 , : ] *= zs
172
172
173
173
pathsegs = path .iter_segments (simplify = False , curves = False )
174
174
for i , ((x , y ), code ) in enumerate (pathsegs ):
@@ -181,7 +181,6 @@ def paths_to_3d_segments(paths, zs=0, zdir='z'):
181
181
"""Convert paths from a collection object to 3D segments."""
182
182
183
183
zs = np .broadcast_to (zs , len (paths ))
184
-
185
184
segs = [path_to_3d_segment (path , pathz , zdir )
186
185
for path , pathz in zip (paths , zs )]
187
186
return np .asarray (segs )
@@ -194,7 +193,7 @@ def path_to_3d_segment_with_codes(path, zs=0, zdir='z'):
194
193
seg3d = np .ones ((3 , len (path )))
195
194
196
195
# Works both if zs is an array and a scalar
197
- seg3d [2 ] *= zs
196
+ seg3d [2 , : ] *= zs
198
197
199
198
pathsegs = path .iter_segments (simplify = False , curves = False )
200
199
codes = np .empty (len (path ))
@@ -472,20 +471,21 @@ def set_3d_properties(self, zs, zdir):
472
471
def do_3d_projection (self , renderer ):
473
472
xs , ys , zs = self ._offsets3d
474
473
vxyzis = proj3d .proj_transform_clip (xs , ys , zs , renderer .M )
474
+ vzs = vxyzis [2 ]
475
475
476
- fcs = (zalpha (self ._facecolor3d , vxyzis [ 2 ] ) if self ._depthshade else
476
+ fcs = (zalpha (self ._facecolor3d , vzs ) if self ._depthshade else
477
477
self ._facecolor3d )
478
478
fcs = mcolors .to_rgba_array (fcs , self ._alpha )
479
479
self .set_facecolors (fcs )
480
480
481
- ecs = (zalpha (self ._edgecolor3d , vxyzis [ 2 ] ) if self ._depthshade else
481
+ ecs = (zalpha (self ._edgecolor3d , vzs ) if self ._depthshade else
482
482
self ._edgecolor3d )
483
483
ecs = mcolors .to_rgba_array (ecs , self ._alpha )
484
484
self .set_edgecolors (ecs )
485
485
PathCollection .set_offsets (self , vxyzis [0 :2 ].T )
486
486
487
- if len ( vxyzis ) > 0 :
488
- return min (vxyzis [ 2 ] )
487
+ if vzs . size > 0 :
488
+ return min (vzs )
489
489
else :
490
490
return np .nan
491
491
@@ -580,9 +580,9 @@ def get_vector(self, segments3d):
580
580
# Store the points in a single array for easier projection
581
581
n_segments = np .sum (self ._seg_sizes )
582
582
# Put all segments in a big array
583
- self . _vec = np .vstack (segments3d )
583
+ _vec = np .vstack (segments3d )
584
584
# Add a fourth dimension for quaternions
585
- self ._vec = np .hstack ([self . _vec , np .ones ((n_segments , 1 ))]).T
585
+ self ._vec = np .hstack ([_vec , np .ones ((n_segments , 1 ))]).T
586
586
587
587
def set_verts (self , verts , closed = True ):
588
588
"""Set 3D vertices."""
0 commit comments