plotly / plotly/plotly.js

Scattergl doesn't fill to zero y (`tozeroy`) properly

Offen
#6,037 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

scatter works fine, but scattergl fills in a wrong way.

a simple demo:

<html>
<head>
    <meta charset="utf-8"/>
    <script src="https://cdn.plot.ly/plotly-2.6.3.min.js"></script>
    <title>plotly tozeroy bug</title>
</head>
<body>
<div>
    <div id="823f03ed-bb11-463b-94a1-dc14225efe68" class="plotly-graph-div" style="height:100%; width:100%;"></div>
    <script type="text/javascript">

        // prepare data
        const x = [];
        const y = [];
        for (let i = -20; i < 20; i += 0.01) {
            x.push(i);
            y.push(Math.sin(i));
        }

        // plot to div
        Plotly.newPlot("823f03ed-bb11-463b-94a1-dc14225efe68",
            [
                {
                    "type": "scatter",
                    "x": x,
                    "y": y,
                    "xaxis": "x",
                    "yaxis": "y",
                    "fill": "tozeroy"
                },
                {
                    "type": "scattergl",
                    "x": x,
                    "y": y,
                    "xaxis": "x2",
                    "yaxis": "y2",
                    "fill": "tozeroy"
                }
            ],
            {
                "xaxis": {"anchor": "y", "domain": [0.0, 1.0]},
                "yaxis": {"anchor": "x", "domain": [0.575, 1.0]},
                "xaxis2": {"anchor": "y2", "domain": [0.0, 1.0]},
                "yaxis2": {"anchor": "x2", "domain": [0.0, 0.425]},
                "title": {"text": "Scatter vs. Scattergl, fill tozeroy"}
            }
        );
    </script>
</div>
</body>
</html>

output:
scatter-tozeroy-bug

related: https://github.com/plotly/plotly.py/issues/2971

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

Führe die eingebettete HTML-Reproduktion mit dem Plotly 2.6.3 CDN aus und vergleiche die scatter- und scattergl-Traces mit fill: "tozeroy". Untersuche den WebGL-Rendering-Pfad hinter scattergl; abgeschlossen ist die Aufgabe, wenn die gefüllte Fläche y=0 erreicht und dem Ergebnis von regulärem scatter für die bereitgestellten Sinuswellendaten entspricht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 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.