plotly / plotly/plotly.py

Fixed line is drawn wrongly after zoom and pan

Open
#3,566 2 comments 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

I experience strange behavior when I zoom and pan in a simple logarithmic scatter plot:
A fixed line, drawn from (0,0) to (100,100), “jumps” to a wrong position after zooming and panning.

Tested on Windows 10, with Plotly 5.0.0, using Python 3.9.

Test code:

import math
import pandas as pd
import plotly.express as px

df = pd.DataFrame([
        [30, 30], 
        [70.0, 70.0]
    ],
    columns=['length', 'width'])

fig = px.scatter(df,
                 x="length",
                 y="width",
                 log_x=True,
                 log_y=True)

fig.update_xaxes(range=[0, math.log10(100*1.1)])
fig.update_yaxes(range=[0, math.log10(100*1.1)])
fig.add_shape(type="line", x0=0.0, y0=0.0, x1=100, y1=100)
fig.show()

PlotlyBug

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

Run the supplied Python example with Plotly 5.0.0 and reproduce the line’s position before and after zooming and panning. Trace how logarithmic axes and the added shape are transformed, then verify that the fixed line remains aligned with the plotted coordinates after interaction.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.