Open neili02 opened 4 years ago
Bug still here, can reproduce with the following, replacing num_elements
from 4
to 3
:
import plotly.graph_objects as go
import numpy as np
num_elements = 4
vmin, vmax = 0, 100
fig = go.Figure(
data=go.Image(
z=np.random.randint(vmin, vmax, size=(32, 32, 3)),
zmin=[vmin] * num_elements,
zmax=[vmax] * num_elements,
colormodel="rgb",
)
)
fig.show()
There seem to be a validation error bug for setting zmin, zmax for rgb images. It appears the validation code expects a tuple or list of size 4 ( as would be the case for rgba) and not size 3 as should be the case for rgb.
im= np.random.randint(256,size=(50,50,3),dtype=np.uint8)
fig = go.Figure(go.Image(z=im,colormodel='rgb',zmin=[10,10,10],zmax=[100,100,100]))
fig.show()
Results in the following error:
ValueError: Invalid value of type 'builtins.tuple' received for the 'zmax' property of image Received value: [100, 100, 100]
(0) The 'zmax[0]' property is a number and may be specified as: