Skip to content

Commit 4d059a3

Browse files
committed
Remove unnecessary manual alpha blending of colorbar solids
1 parent 5bf9b1c commit 4d059a3

1 file changed

Lines changed: 0 additions & 24 deletions

File tree

proplot/axes/base.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,30 +2240,6 @@ def _draw_colorbar(
22402240
axis.set_ticks(ticks, minor=True)
22412241
axis.set_ticklabels([], minor=True)
22422242

2243-
# Fix alpha-blending issues. Cannot set edgecolor to 'face' because blending
2244-
# will occur, get colored lines instead of white ones. Need manual blending.
2245-
# NOTE: For some reason cb solids uses listed colormap with always 1.0 alpha,
2246-
# then alpha is applied after. See: https://stackoverflow.com/a/35672224/4970632
2247-
cmap = obj.cmap
2248-
blend = rc.get('pcolormesh.snap', False) # rely on this only if available
2249-
if not cmap._isinit:
2250-
cmap._init()
2251-
if blend and any(cmap._lut[:-1, 3] < 1):
2252-
warnings._warn_proplot(
2253-
f'Using manual alpha-blending for {cmap.name!r} colorbar solids.'
2254-
)
2255-
lut = cmap._lut.copy()
2256-
cmap = mcolors.Colormap('_no_name', N=cmap.N)
2257-
cmap._isinit = True
2258-
cmap._init = lambda: None
2259-
for i in range(lut.shape[0] - 1):
2260-
alpha = lut[i, 3]
2261-
lut[i, :3] = (1 - alpha) * 1 + alpha * lut[i, :3] # blend *white*
2262-
lut[i, 3] = 1 # set to opaque
2263-
cmap._lut = lut
2264-
obj.cmap = cmap
2265-
obj.draw_all() # update contents
2266-
22672243
# Fix colorbar outline
22682244
kw_outline = {'edgecolor': color, 'linewidth': linewidth}
22692245
if obj.outline is not None:

0 commit comments

Comments
 (0)