Plotly graph objects, add colours to individual linestrings in geojson

Hi all,

I’m fairly new to plotly and have been trying to colour code a linestring geojson from a separate pandas csv. The below code will generate a map from a geojson file and import the csv to a pandas dataframe but I’m struggling on how I link the two together and then start with colour coding based on one of the fields in the dataframe.

Guess it’s either fairly basic and I’m missing the trick somewhere or there’s a better option out there. I’ve seen how easy it’s to do in choropleth maps but that’s sadly not my thing here. Both the geojson and pandas dataframe have a unique identifier, call it UniqueFieldID for both.

Any help appreciated.

import pandas as pd
import as px
import plotly.graph_objects as go
import geopandas as gpd
import shapely.geometry
import json

df = pd.read_csv ("csv_here",  usecols= ['UniqueFieldID','ColourCodingField'])

with open('geoj_here') as json_file:
    geoj_df= json.load(json_file)
fig = go.Figure(data=[go.Scattermapbox(
    lat=[0], lon=[0]

        style="open-street-map", #"open-street-map", "carto-positron", "carto-darkmatter", "stamen-terrain", "stamen-toner" or "stamen-watercolor"
        center_lat = 52.5,
        center_lon = -1.9,
            'sourcetype': 'geojson',
            'source': geoj_df,
            'type': 'line',