plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

BUG: Image ignores alpha channel

Open KylevdLangemheen opened this issue 3 years ago • 0 comments

classmethod plotly.graph_objects.Figure.add_image and class plotly.graph_objects.Image have z as a parameter, which accepts: "A 2-dimensional array in which each element is an array of 3 or 4 numbers representing a color".

However, the alpha value for arrays containing rgba is ignored:

import plotly.graph_objs as go
import numpy as np

img = np.random.rand(200,200,4)
img = (img * [255,255,255,0])

fig = go.Figure()
fig.add_trace(go.Image(
    z=img,
))
fig.show()

The above should show a completely transparent (empty) image, as alpha is set to 0. However, the alpha channel is clearly ignored. This is despite the fact that add_image / Image support the opacity parameter.

KylevdLangemheen avatar Sep 21 '22 11:09 KylevdLangemheen