Bug or undesired behaviour with Scattergl and mode = 'text'


I’ve been using Scattergl traces in order to display genomic sequence data along other information, supplying different tracks for each of the four bases. This seemed to work pretty well, it was fast and unlike regular Scatter traces it allowed fluid scrolling.

Unfortunately we discovered that if the x values reach a certain domain the text display starts breaking:

In tests, once x values were around 10000000, the text wasn’t centered on the corresponding data points anymore and instead only loosly associated to it, when scrolling along the x axis the text wouldn’t scroll with the data point until a certain threshhold was passed. The higher the values become the more extreme this behaviour gets. The number of datapoints did not make a difference for this, it happened wether I used 10 or 1000.

In our case this led to the different text traces being drawn on top of each other, e.g we would have multiple letters on the same position. Since positions in genomes will easily get to these high values this ment that we had to opt for an alternative by just showing a colored heatmap with tooltips, or using Scatter traces, which are signifficantly slower.

Here is a screenshot of the issue:

As you can see at some positions the letters are on top of each other. The following spoiler contains a minimal example trace that will only show the text on the far left due to the high x values. If you decrease the values for x to 10000000 you will start seeing the behaviour where text is only loosly bound to data points.

minimal example
valueList = list(range(1000000000,1000000010))
fig = tools.make_subplots(rows=2,cols=1,shared_xaxes = True)
        text = ['T']*len(valueList),
        textfont = dict(color = 'rgb(0, 0, 0)'),
        y = [1]*len(valueList),
        x = valueList,
        mode = 'text+markers',
        showlegend = False,
        opacity = 0.5,
        textposition = "bottom center",