Black Lives Matter. Please consider donating to Black Girls Code today.

Scattergl: How to display labels of points?

Hello,

With scattergl, I cannot display the text that is stored in the traces data structure.
In scatter, I use the type:markers+text, but it seems not working the same way with scattergl.

Thanks for your help!

var trace = {
x: [1, 2, 3, 4, 5],
y: [1, 6, 3, 6, 1],
mode: ‘markers+text’,
type: ‘scattergl’,
name: ‘Team A’,
text: [‘A-1’, ‘A-2’, ‘A-3’, ‘A-4’, ‘A-5’],
textposition: ‘top center’,
textfont: {
family: ‘Raleway, sans-serif’
},
marker: { size: 12 }
};
var layout = {
xaxis: {title: ‘PC’ + dim1, type:‘linear’},
yaxis: {title: ‘PC’ + dim2, type:‘linear’},
hovermode: ‘closest’,
dragmode:‘pan’,
showlegend:false,
margin: { t: 0 },
legend: {
yref: ‘paper’,
font: {
family: ‘Arial, sans-serif’,
size: 20,
color: ‘grey’,
}
},
title:‘test plot’
};

Plotly.plot(‘myDiv’, [trace] , layout);

The text mode isn’t supported in scattergl traces.

You might want to took a look at https://github.com/plotly/plotly.js/issues/130 for the complete list of known gl2d limitations.

Thanks for you reply!