plotly / plotly/plotly.py

`zmax` argument not effective in `px.imshow` when `img` contains `np.nan`

Open
#4,299 0 comments 0 reactions 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

Results for

import pandas as pd
import numpy as np
import plotly.express as px

df = pd.DataFrame({"foo": [1, 2, 3]})
px.imshow(df, zmax=2)

image

Results for

import pandas as pd
import numpy as np
import plotly.express as px

df = pd.DataFrame({"foo": [1, 2, 3, np.nan]})
px.imshow(df, zmax=2)

image

When df contains np.nan, zmax is not taking effect. Intesrestingly, if zmin is specified at the same time, it works.

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 running the two px.imshow examples from the issue and compare the zmax behavior with and without np.nan. Locate the px.imshow implementation and its existing tests, then add coverage showing that zmax=2 remains effective for data containing np.nan; the issue is done when that regression passes.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.