Black Lives Matter. Please consider donating to Black Girls Code today.

Custom Legend not tied to traces

Hello! I’m wondering if there is a way to make a custom legend for a graph that isn’t tied to traces. For instance I have this scattermapbox here.
SCM
And I want a legend that says that the blue dot is the starting point and the red is the ending point. Adding traces ins’t an option for me unfortunately because it would complicate other aspects of my code. Any advice on how to do this or any plans to add a feature like this in the future?

Hi @Krichardson, I don’t think you can do what you’re looking for with a legend, but I have two different suggestions:

1 Like

Thank you Emmanuelle! I’ll look into these solutions!

Actually I still have one question. How do add an annotation to a Scattermapbox? When creating an annotation, the x and y parameters don’t seem to correspond to the latitude and longitude of the mapbox. I’m attempting to create the annotation within the layout like this:

annotations=
                [
                    go.layout.Annotation(
                        x=longitudes[0],
                        y=latitudes[0],
                        xref="x",
                        yref="y",
                        text='Start',
                        showarrow=True,
                    )
                ],