plotly / plotly/plotly.js

Lines on scatter graph not showing up

Đang mở
#4,836 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug P3
Ngôn ngữ chính
JavaScript
Star
18.3k
Fork
2k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
28

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện báo cáo với plotly.js 1.54.1 cùng dữ liệu phân tán và layout được cung cấp, truyền vào Plotly.newPlot("distribution", data, layout). So sánh cách hiển thị của cùng các trace khi sử dụng mode 'lines' với 'markers', bao gồm fill: 'tozeroy'; được xem là hoàn tất khi các đường và phần tô được hiển thị với cấu hình được báo cáo hoặc vấn đề được thu hẹp thành một điều kiện dữ liệu hoặc layout đã được tài liệu hóa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.