I want to have multiple distinct lines on a map, some should have the same colour, and some should be distinct. Due to the number of lines, it isnβt practical to have them as individual traces. If we run this:
l1 = [1,2,3, None, 4,5,6]
l2 = [1,2,3, None, 4,5,6]
_hover_names = ["a","b","c",None,"d","e","f"]
_colour_idx = [0,0,0,None,1,1,1]
fig = px.line_mapbox(lat=l1, lon=l2, hover_name=_hover_names, zoom=1.5, color_discrete_sequence=colours, color = _colour_idx)
fig.show()
You get two individual lines. However, if you keep all the None
βs but give the second line the same colour group as the first
_colour_idx = [0,0,0,None,0,0,0]
fig = px.line_mapbox(lat=l1, lon=l2, hover_name=_hover_names, zoom=1.5, color_discrete_sequence=colours, color = _colour_idx)
The lines are now being connected. I appreciate they are the same colour group, but this would seem unusual to be a feature, especially given in the plotly docs there is an example were None
is used to disconnect lines which are all of the same colour.
If this is a bug I can report it on the plotly github