How to add categorical color legend for scatter plot created by graph_objects

Does this work for you?

import plotly.graph_objects as go

fig = go.Figure(data=go.Scatter(
    x=[1, 2, 3, 4],
    y=[10, 11, 12, 13],
    mode='markers',
    marker=dict(size=[40, 60, 80, 100],
                color=[0, 1, 2, 3])
))

fig.update_xaxes(tickmode = 'array',
                 tickvals = [1, 2, 3, 4],
                 ticktext = ['Elephant','Lion', 'Tiger', 'Dolphin'],
                 ticks="",
                 tickfont=dict(size=20)
                )

fig.show()

Edit: Sorry, misread, I guess. Color legend/trace will stay the same. Would like to know that too?!