plotly / plotly/plotly.js

Lines on scatter graph not showing up

Abierto
#4,836 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug P3
Lenguaje dominante
JavaScript
Estrellas
18.3k
Forks
2k
Merge medio
2 d 12 h
PR fusionados (30 d)
28

Descripción

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);

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza reproduciendo el informe con plotly.js 1.54.1 y los datos de dispersión y el layout proporcionados, pasados a Plotly.newPlot("distribution", data, layout). Compara la representación de los mismos trazos usando mode 'lines' frente a 'markers', incluido fill: 'tozeroy'; se considera terminado cuando las líneas y el relleno se representan para la configuración indicada en el informe o el problema se ha reducido a una condición documentada de los datos o del layout.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
data-visualization
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.