plotly / plotly/plotly.py

Imshow behaviour incorrect with log scale on yaxis

Open
#4,284 2 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

Plotly version: 5.15.0

I'm passing some values to the yaxis of px.imshow. If I just plot it as-is it's fine

import plotly.express as px
fig = px.imshow(
    img = [[1,2], [3,4], [5,6]],
    x = ['A', 'B'],
    y = [10, 100, 1000],
    text_auto=True,
    width=600
)
fig.update_yaxes(autorange='reversed')

immagine

But if I change the yaxis type to log using fig.update_yaxis, the first row of data disappears

import plotly.express as px
fig = px.imshow(
    img = [[1,2], [3,4], [5,6]],
    x = ['A', 'B'],
    y = [10, 100, 1000],
    text_auto=True,
    width=600
)
fig.update_yaxes(type='log', autorange='reversed')

immagine

Playing around with the yaxis values doesn't seem to affect this behaviour

immagine

Note: It seems to depend only on the closeness of the first and second yaxis values

immagine

VS

immagine

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 with the reproducible Python example using px.imshow and fig.update_yaxes(type='log', autorange='reversed'), then compare the log-scale rendering with the linear-scale result. Done means the first row remains visible for the reported y-axis values while reversed autorange and log scaling still work correctly.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.