plotly / plotly/plotly.js

Lines on scatter graph not showing up

Aperta
#4,836 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug P3
Lingua principale
JavaScript
Stelle
18.3k
Fork
2k
Merge medio
2g 12h
PR unite (30g)
28

Descrizione

I have been trying to figure out this issue without opening a ticket for the mean time and have followed all the guides on using plotly.js in typescript and for the most part the plugin works and works well however some of the functionality is just not working the biggest issue is certain lines are not showing up.

When I make a scatter graph all of the data and information is there mostly visible but when the trace mode is just mode: 'lines' the lines do not show up.

Screen Shot 2020-05-15 at 10 59 08 AM

and when I change the mode to mode: 'markers'

Screen Shot 2020-05-15 at 11 00 25 AM

witch is a decent work around for the problem but I also need to fill: 'tozeroy' that isn't working either.

Currently using;
"plotly.js": "^1.54.1"

Here is the code that is used to generate these graphs

let data: any[] = [{ 
      x: this.plotData.z,
      y: this.plotData.y,
      type: 'scatter',
      mode: 'markers',
      fill: 'tozeroy',
      fillcolor: '#A6CEE3',
      marker: {
        color: 'black',
        size: 3
      }
    }];
    
    let layout: any = {
      title: `Standard Normal Distribution`,
      showlegend: false,
      xaxis: {
        ticks: 'outside',
        zeroline: false,
        showgrid: false
      },
      yaxis: {
        rangemode: 'tozero',
        zeroline: true,
        showline: false,
        showticklabels: false,
        showgrid: false
      },
      annotations: [
         {
           text: Math.round((100*this.Pval/2)*100)/100 + '%',
           x: Math.abs(this.teststat),
           y: 0,
           xref: 'x',
           yref: 'y',
           xshift: 12,
           yshift: -2,
           ax: 2.5,
           ay: 0.1,
           axref: 'x',
           ayref: 'y',
           bordercolor: 'black',
           showarrow: true
         }
      ],
      height: 200,
      margin: {
        l: 0,
        r: 0,
        b: 35,
        t: 50,
        pad: 0
      },
      displaylogo: false
    };

    if(this.mode == 'two') {
      let index: PlotData;
      index = await this.pullData(-Math.abs(this.teststat), '<=');
      data.push({
        x: index.z,
        y: index.y,
        type: 'scatter',
        mode: 'markers',
        fill: 'tozeroy',
        fillcolor: '#1F78B4',
        marker: {
          color: '#1F78B4',
          size: 3
        },
        name: 'P-value',
        hoverinfo: 'name'
      })
      index = await this.pullData(Math.abs(this.teststat), '>=');
      data.push({
        x: index.z,
        y: index.y,
        type: 'scatter',
        mode: 'markers',
        fill: 'tozeroy',
        fillcolor: '#1F78B4',
        marker: {
          color: '#1F78B4',
          size: 3
        },
        name: 'P-value',
        hoverinfo: 'name'
      })
      layout.annotations.push({
        x: -Math.abs(this.teststat),
        y: R.dnorm(this.teststat)/2,
        xshift: -12,
        yshift: -2,
        text: Math.round((100*this.Pval/2) * 100)/100 + '%',
        bordercolor: 'black',
        xref: 'x',
        yref: 'y',
        showarrow: true,
        arrowhead: 2,
        ax: -2.5,
        ay: 0.1,
        axref: 'x',
        ayref: 'y'
      })
      layout.annotations.push({
        x: Math.abs(this.teststat),
        y: R.dnorm(this.teststat)/2,
        xshift: -12,
        yshift: -2,
        text: Math.round((100*this.Pval/2) * 100)/100 + '%',
        bordercolor: 'black',
        xref: 'x',
        yref: 'y',
        showarrow: true,
        arrowhead: 2,
        ax: -2.5,
        ay: 0.1,
        axref: 'x',
        ayref: 'y'
      })
    }

    if(this.mode == 'less') {
      let index: PlotData;
      index = await this.pullData(Math.abs(this.teststat), '<=');
      data.push({
        x: index.z,
        y: index.y,
        type: 'scatter',
        mode: 'markers',
        fill: 'tozeroy',
        fillcolor: '#1F78B4',
        marker: {
          color: '#1F78B4',
          size: 3
        },
        name: 'P-value',
        hoverinfo: 'name'
      })
      layout.annotations.push({
        x: Math.abs(this.teststat),
        y: R.dnorm(this.teststat)/2,
        xshift: -12,
        yshift: -2,
        text: Math.round((100*this.Pval) * 100)/100 + '%',
        bordercolor: 'black',
        xref: 'x',
        yref: 'y',
        showarrow: true,
        arrowhead: 2,
        ax: -2.5,
        ay: 0.1,
        axref: 'x',
        ayref: 'y'
      })
    }

    if(this.mode == 'great'){
      let index: PlotData;
      index = await this.pullData(Math.abs(this.teststat), '>=');
      data.push({
        x: index.z,
        y: index.y,
        type: 'scatter',
        mode: 'markers',
        fill: 'tozeroy',
        fillcolor: '#1F78B4',
        marker: {
          color: '#1F78B4',
          size: 3
        },
        name: 'P-value',
        hoverinfo: 'name'
      })
      layout.annotations.push({
        x: Math.abs(this.teststat),
        y: R.dnorm(this.teststat)/2,
        xshift: -12,
        yshift: -2,
        text: Math.round((100*this.Pval) * 100)/100 + '%',
        bordercolor: 'black',
        xref: 'x',
        yref: 'y',
        showarrow: true,
        arrowhead: 2,
        ax: -2.5,
        ay: 0.1,
        axref: 'x',
        ayref: 'y'
      })
    }

    Plotly.newPlot("distribution", data, layout);

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il report con plotly.js 1.54.1 e i dati scatter e il layout forniti, passati a Plotly.newPlot("distribution", data, layout). Confronta il rendering delle stesse tracce usando mode 'lines' rispetto a 'markers', incluso fill: 'tozeroy'; il lavoro è completato quando le linee e il riempimento vengono renderizzati per la configurazione riportata, oppure il problema è stato ristretto a una condizione documentata dei dati o del layout.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.