Merge pull request #12069 from anntzer/3dstyle · matplotlib/matplotlib@6a896b0 · GitHub
Skip to content

Commit 6a896b0

Browse files
authored
Merge pull request #12069 from anntzer/3dstyle
Style fixes for mplot3d.
2 parents 848d9fc + 631c7c9 commit 6a896b0

4 files changed

Lines changed: 55 additions & 61 deletions

File tree

.flake8

Lines changed: 0 additions & 2 deletions

lib/matplotlib/transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ def update_from_data_xy(self, xy, ignore=None, updatex=True, updatey=True):
920920

921921
path = Path(xy)
922922
self.update_from_path(path, ignore=ignore,
923-
updatex=updatex, updatey=updatey)
923+
updatex=updatex, updatey=updatey)
924924

925925
@BboxBase.x0.setter
926926
def x0(self, val):

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ def draw(self, renderer):
108108
[self._position3d, self._position3d + self._dir_vec], renderer.M)
109109
dx = proj[0][1] - proj[0][0]
110110
dy = proj[1][1] - proj[1][0]
111-
if dx==0. and dy==0.:
112-
# atan2 raises ValueError: math domain error on 0,0
113-
angle = 0.
114-
else:
115-
angle = math.degrees(math.atan2(dy, dx))
111+
angle = math.degrees(math.atan2(dy, dx))
116112
self.set_position((proj[0][0], proj[1][0]))
117113
self.set_rotation(norm_text_angle(angle))
118114
mtext.Text.draw(self, renderer)
@@ -318,7 +314,7 @@ def do_3d_projection(self, renderer):
318314
def get_patch_verts(patch):
319315
"""Return a list of vertices for the path of a patch."""
320316
trans = patch.get_patch_transform()
321-
path = patch.get_path()
317+
path = patch.get_path()
322318
polygons = path.to_polygons(trans)
323319
if len(polygons):
324320
return polygons[0]
@@ -469,10 +465,7 @@ def do_3d_projection(self, renderer):
469465
self.set_edgecolors(ecs)
470466
PathCollection.set_offsets(self, np.column_stack([vxs, vys]))
471467

472-
if vzs.size > 0 :
473-
return min(vzs)
474-
else :
475-
return np.nan
468+
return np.min(vzs) if vzs.size else np.nan
476469

477470

478471
def patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True):
@@ -563,7 +556,7 @@ def get_vector(self, segments3d):
563556

564557
if len(segments3d):
565558
xs, ys, zs = zip(*points)
566-
else :
559+
else:
567560
# We need this so that we can skip the bad unpacking from zip()
568561
xs, ys, zs = [], [], []
569562

@@ -651,12 +644,12 @@ def do_3d_projection(self, renderer):
651644
zvec = np.array([[0], [0], [self._sort_zpos], [1]])
652645
ztrans = proj3d.proj_transform_vec(zvec, renderer.M)
653646
return ztrans[2][0]
654-
elif tzs.size > 0 :
647+
elif tzs.size > 0:
655648
# FIXME: Some results still don't look quite right.
656649
# In particular, examine contourf3d_demo2.py
657650
# with az = -54 and elev = -45.
658651
return np.min(tzs)
659-
else :
652+
else:
660653
return np.nan
661654

662655
def set_facecolor(self, colors):

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 48 additions & 45 deletions

0 commit comments

Comments
 (0)