Increase detail in a scattergl plot with a large number of points

I’m trying to plot about 500 000 points using scattergl in order to make a 2D map, and mostly, it works really well! My issue is that it seems like there is some sort of image compression happening that causes a loss of detail when looking close up at the plot. I’m not sure if I can share the plot freely due to IP issues, but here is kind of what I have so far (important? data cropped out):

Looking at noisy regions, you can see that everything looks quite compressed:

I assume this is in part due to using scattergl instead of scatter, however it seems like trying to use scatter generally causes the notebook to crash.

This is essentially what my script looks like (I’ve removed some formatting things that I think are unlikley to be related to my issue e.g. colourbar formatting, tick values, etc):

using PlotlyJS

#to avoid too much empty space between the data and the axes
minx = minimum(df.qx)
maxx = maximum(df.qx)
minz = minimum(df.qz)
maxz = maximum(df.qz)

#multiplying these by 10 causes jupyterlab to show "your browser does not support webgl"
#values chosen for a square plot

width2 = 511#900
height2 = floor(Int,width * l_0 / l_1) #800

p = plot(scattergl(

    df, x=:qx, y=:qz, marker=attr(color=:Countslog, symbol="diamond", size=0.75, 
    mode="markers"
))


#make the plot square
relayout!(
    p, 
    autosize=0,
    width=width2,
    height=height2, 
    xaxis_range=[minx, maxx],
    yaxis_range=[minz, maxz],
    hovermode=false, #otherwise my computer stutters when the mouse goes over the plot
    plot_bgcolor="rgba(255, 255, 255, 1)",
    margin=attr(
        l=50,
        r=50,
        b=100,
        t=100,
        pad=2
    ),
    
)

p

The data is in the following form:
image
(+another 500000 lines)

Is there a way to increase the resolution scattergl renders at? Do I just need to play around with width and height until I find something that works?

hey @KaylaTAL I actuall can’t really give any advice, but my experience is that plotly struggles with increasing datapoints. Thats the reason scatterGL was developed, I think.

Maybe you could use dash and adjust the amount of points visible in the graph depending on the scale of the axes, aka the zoom.

Something along the lines of this: