Lines on scatter graph not showing up
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
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.

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

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);
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 plotly.js 1.54.1 以及传入 Plotly.newPlot("distribution", data, layout) 的所提供散点数据和布局来复现报告。比较使用 mode 'lines' 与 'markers'(包括 fill: 'tozeroy')时相同 traces 的渲染结果;当所报告的配置能够渲染线条和填充,或问题已缩小到一个有文档记录的数据或布局条件时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100