Using line_group slows down line_mapbox significantly

I am using plotly expresses line_mapbox to plot a bunch of line segments on a map.

I am plotting 300k line segments split into 38k different line_groups.

If I plot this without using the line_group parameter then everything plots in a matter of seconds and things are fine.

If I use the line_groups parameter however then it completely freezes and nothing ever gets plottet. Even with a much smaller subset of just 1000 line segments the line_group parameter makes the plotting take about 10 seconds.

I can achieve the results I want by inserting NaN in my lat/lon array after each line_group (since my data is ordered), however I feel like this is a hack and that it should work with line_group.

Does anyone else have this experience? or any suggestions for how to fix it?

Here is what the data looks like that I’m plotting

             lat       lon  linesegment_id pipe_type
0      56.188831  9.534314               0      STIK
0      56.188830  9.534314               0      STIK
0      56.188818  9.534312               0      STIK
0      56.188804  9.534299               0      STIK
0      56.188790  9.534268               0      STIK
...          ...       ...             ...       ...
37823  56.203743  9.611348           37823      STIK
37823  56.203742  9.611336           37823      STIK
37823  56.203742  9.611326           37823      STIK
37823  56.203745  9.611313           37823      STIK
37823  56.203748  9.611300           37823      STIK
[299653 rows x 4 columns]

And here is how I plot it:


    fig = px.line_mapbox(df2.iloc[:1000],
                         lat='lat',
                         lon='lon',
                         color='pipe_type',
                         # line_group='linesegment_id',
                         zoom=12,
                         height=1600,
                         width=1600)
    fig.update_layout(mapbox_style="open-street-map")
    fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
    fig.show()