plotly / plotly/plotly.py

ValueError when setting zmin, zmax for rgb image

Open
#1,973 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

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:

File "C:\Users\NA\Anaconda3\lib\site-packages_plotly_utils\basevalidators.py", line 283, in raise_invalid_val

valid_clr_desc=self.description(),

ValueError:
Invalid value of type 'builtins.tuple' received for the 'zmax' property of image
Received value: [100, 100, 100]

The 'zmax' property is an info array that may be specified as:

* a list or tuple of 4 elements where:

(0) The 'zmax[0]' property is a number and may be specified as:
- An int or float
(1) The 'zmax[1]' property is a number and may be specified as:
- An int or float
(2) The 'zmax[2]' property is a number and may be specified as:
- An int or float
(3) The 'zmax[3]' property is a number and may be specified as:
- An int or float

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided NumPy and go.Image example with an RGB array and zmin/zmax values of length three. Trace the image property validation that raises the ValueError and compare it with RGBA handling. Done means RGB limits are accepted while existing RGBA validation remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data-visualization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.