Skip to content

View jumps when zooming line graph #5107

Description

@mikypilota

I am experiencing the same problem described in this issue for Plotly.js.

In my python implementation, the line graph is so configured:

{
    "xaxis": dict(
        gridcolor="rgba(128, 128, 128, 0.2)",
        zerolinecolor="rgba(128, 128, 128, 0.2)",
        showgrid=True,
        type="date",
        tickformatstops=(
            [dict(dtickrange=[None, None], value="%a %d %b %y - %H:%M")]
        ),
    ),
    "yaxis": dict(
        gridcolor="rgba(128, 128, 128, 0.2)",
        zerolinecolor="rgba(128, 128, 128, 0.2)",
        showgrid=True,
    ),
    "spikedistance": -1,
    "xaxis_showspikes": True,
    "yaxis_showspikes": True,
    "xaxis_spikemode": "across",
    "yaxis_spikemode": "across",
    "xaxis_spikecolor": "rgba(255,255,255,0.5)",
    "yaxis_spikecolor": "rgba(255,255,255,0.5)",
    "xaxis_spikethickness": 1,
    "yaxis_spikethickness": 1,
}

The problem seems to surface when the tick text is long enough and when zooming will cause the tick text to end up at a particular distance from the edge of the line graph. I notice it happens more often when the tick text overflows following a zoom and will be subsequently hidden.

The issue won't occur if I do:

tickformatstops=(
   [dict(dtickrange=[None, None], value="%H:%M")]`
),

Because the resulting tick text won't be long enough.

Activity

  1. changed the title [-]View scatters when zooming line graph[/-] [+]View jumps when zooming line graph[/+] on Mar 22, 2025
  2. mikypilota commented on Mar 22, 2025

    @mikypilota
    Author

    For some severely screwed up reason, setting:

    margin=dict(l=80, r=80, t=20, b=20),

    Stops the jumping.

    I needed to play with those numbers a bit, it will work only after a certain threshold (ie 50 was not enough for me).

  3. added
    bugsomething broken
    P2considered for next cycle
    on Mar 24, 2025
  4. gvwilson commented on Mar 24, 2025

    @gvwilson
    Contributor

    thanks for the bug report and the follow-up - I'm marking this as P2 because I suspect the fix will have to be made in the plotly.js issue. Thanks - @gvwilson

  5. mikypilota commented on Mar 24, 2025

    @mikypilota
    Author

    @gvwilson You're most welcome. In fact, thank you.

  6. emilykl commented on Aug 28, 2026

    @emilykl
    Contributor

    @mikypilota If this issue has the same root cause as plotly/plotly.js#6235, it should be fixed by plotly/plotly.js#7815 and the fix is available in the latest plotly.py version, v7.0.0.

    Give it a try and let us know if it fixes the issue for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cyclebugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions