plotly / plotly/plotly.js

Inconsistent `gap` attributes causes misalignment

Offen
#7,133 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug sev-3
Vorherrschende Sprache
JavaScript
Sterne
18.3k
Forks
2k
Ø Merge
2 T. 12 Std.
Gemergte PRs (30 T.)
28

Beschreibung

If you provide both bargap and scattergap but they're different, traces in the same alignment and offset group do not properly align. One way or another, ensuring these traces align is more important than honoring both gaps. Here, the orange and green scatter points should be centered on the bars of the same color, but they are not:
Screenshot 2024-08-27 at 10 41 13

https://codepen.io/alexcjohnson/pen/yLdEZvo?editors=0010

This is a little tricky though:

  • If there are no bar traces, bargap will not be defined, so scattergap should be honored.
  • Even if there are bar traces but only scattergap is explicitly given, seems like it should be honored and used as the bargap value as well.
  • There are also boxgap and violingap - in principle you could have ALL of these traces in the same alignment and offset groups, do we define a hierarchy, something like bar beats scatter beats box beats violin? Or do we take the gap from the first trace in the group, and use that for all traces in that group? Or the maximum gap that applies to any trace in the group? I have no strong opinions here, so long as the result is always proper alignment.
  • All but scatter also have *groupgap attributes. There's no problem allowing these to be different.

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 mit der Behandlung von Ausrichtung und Offset-Gruppen für bar-, scatter-, box- und violin-Traces und reproduziere die Abweichung mit dem verlinkten CodePen. Vergleiche Fälle mit fehlenden oder explizit gesetzten gap-Attributen und lege anschließend eine konsistente Regel zur Auswahl des gemeinsamen gap fest, wobei die korrekte Ausrichtung erhalten bleibt. Als abgeschlossen gilt die Aufgabe, wenn Traces in denselben Gruppen über alle relevanten Trace-Kombinationen hinweg korrekt zentriert sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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