From 3f59cdec57976ba0564887850541c0bd974c1e10 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 20 Jan 2019 07:08:08 +0100 Subject: [PATCH] Vectorize mplot3d.art3d.zalpha. I intentionally did not deprecate the now unused get_colors, as there's already another PR doing that. --- lib/mpl_toolkits/mplot3d/art3d.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/mpl_toolkits/mplot3d/art3d.py b/lib/mpl_toolkits/mplot3d/art3d.py index 62f73e4ea7fb..808ee5a95f7c 100644 --- a/lib/mpl_toolkits/mplot3d/art3d.py +++ b/lib/mpl_toolkits/mplot3d/art3d.py @@ -790,9 +790,9 @@ def zalpha(colors, zs): # in all three dimensions. Otherwise, at certain orientations, # the min and max zs are very close together. # Should really normalize against the viewing depth. - colors = get_colors(colors, len(zs)) - if len(zs): - norm = Normalize(min(zs), max(zs)) - sats = 1 - norm(zs) * 0.7 - colors = [(c[0], c[1], c[2], c[3] * s) for c, s in zip(colors, sats)] - return colors + if len(zs) == 0: + return np.zeros((0, 4)) + norm = Normalize(min(zs), max(zs)) + sats = 1 - norm(zs) * 0.7 + rgba = np.broadcast_to(mcolors.to_rgba_array(colors), (len(zs), 4)) + return np.column_stack([rgba[:, :3], rgba[:, 3] * sats]) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy