Lines on scatter graph not showing up
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 18.3k
- Forks
- 2k
- Merge moyen
- 2 j 12 h
- PR mergées (30 j)
- 28
Description
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);
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par reproduire le rapport avec plotly.js 1.54.1 et les données de dispersion et le layout fournis, passés à Plotly.newPlot("distribution", data, layout). Comparez le rendu des mêmes traces en utilisant mode 'lines' par rapport à 'markers', y compris fill: 'tozeroy' ; le travail est considéré comme terminé lorsque les lignes et le remplissage sont rendus pour la configuration signalée, ou que le problème est circonscrit à une condition documentée des données ou du layout.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100