8000 Minor code cleanup by timhoffm · Pull Request #12826 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Minor code cleanup #12826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1732,14 +1732,14 @@ def get_normals(polygons):
return polyc

def _generate_normals(self, polygons):
'''
"""
Generate normals for polygons by using the first three points.
This normal of course might not make sense for polygons with
more than three points not lying in a plane.

Normals point towards the viewer for a face with its vertices in
counterclockwise order, following the right hand rule.
'''
"""

normals = []
for verts in polygons:
Expand All @@ -1749,10 +1749,10 @@ def _generate_normals(self, polygons):
return normals

def _shade_colors(self, color, normals, lightsource=None):
'''
"""
Shade *color* using normal vectors given by *normals*.
*color* can also be an array of the same length as *normals*.
'''
"""
if lightsource is None:
# chosen for backwards-compatibility
lightsource = LightSource(azdeg=225, altdeg=19.4712)
Expand All @@ -1762,7 +1762,7 @@ def _shade_colors(self, color, normals, lightsource=None):
for n in normals])
mask = ~np.isnan(shade)

if len(shade[mask]) > 0:
if mask.any():
norm = Normalize(min(shade[mask]), max(shade[mask]))
shade[~mask] = min(shade[mask])
color = mcolors.to_rgba_array(color)
Expand Down
0