Thanks to visit codestin.com
Credit goes to github.com

Skip to content

imshow(..., alpha=0.5) produces different results in 2.x #6540

Closed
@QuLogic

Description

@QuLogic

I think I have whittled this down sufficiently from the Cartopy example that is failing. Running imshow(..., alpha=0.5) produces a different result in 2.0.0b1 vs. 1.5.1 (both installed via conda.)

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

# mpl.style.use('classic')

im = np.zeros((100, 100, 3), dtype=np.uint8)
plt.imshow(im, extent=(1, 10, 1, 10), alpha=0.5)
plt.xlim(0, 11)
plt.ylim(0, 11)

plt.savefig('imshow_alpha.png')

Using 1.5.1:
imshow_alpha_1 5 1
Using 2.0.0b1:
imshow_alpha_2 0
Using 2.0.0b1 with the classic style:
imshow_alpha_2 0_classic

GIMP tells me that the first is 50%, while the latter two are 75%.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions