plotly / plotly/plotly.py

Hover tooltip works incorrectly in scatter WebGL

Offen
#3,516 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P3
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

In the code example below (using the scattergl) when the cursor is rolled over the bubble, the hover tooltip does not appear until the cursor is close to the center of the bubble. The tooltip itself also points to the center of the bubble.

This is different from the expected behavior observed with the regular scatter where the tooltip appears in relation to the boundary of the bubble, rather than its center. And the tooltip points to the boundary as well.

For the Plotly Express px.scatter, one needs to set render_mode='svg' to switch out of WebGL for the correct behaviour.

This results in an incorrect tooltip in WebGL appearing when the cursor is over the larger bubble in an example such as this one:

bubble

import pandas as pd
import plotly.graph_objects as go

df = pd.DataFrame({'x': [1], 'y': [1],'z': [100]})

fig = go.Figure()

fig.add_scattergl(
    x=df['x'],
    y=df['y'],
    marker_size=df['z'],
    mode='markers',
    marker_sizeref=0.01,
    marker_sizemode='area',
    showlegend=True,
    hovertemplate=(
        'x: %{x:.2f}<br>'
        'y: %{y:.2f}<br>'
        '<extra></extra>'
    ),
)

fig.show()

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das bereitgestellte Python-Beispiel mit go.Figure.add_scattergl auszuführen und sein Hover-Verhalten mit dem von regulärem scatter zu vergleichen. Verfolge die WebGL-Hover-Behandlung vom scattergl-Einstiegspunkt aus und verwende dabei das erwartete grenzbasierte Tooltip-Verhalten sowie den Vergleich mit render_mode='svg' als Referenzen. Erledigt ist die Aufgabe, wenn große Blasen über ihre gesamte sichtbare Fläche reagieren und das Tooltip auf den Rand zeigt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data-visualization, frontend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.