How can I put shape in trace?


Hi, I’m working on Plotly, to show coordinates.

What I wanna try to do β†’ when I turn off the button, the center of circle (dots) shows up,
and when I turn on, the whole circles can be shown.

But I used fig.add_shape, and it’s cannot be worked as trace. Is there any other way to add shapes in trace?

You are trying to change the marker style? If so, you could try something like this:

import plotly.express as px

fig = px.scatter(x=[1,6,9],y=[7,5,4])

# base style of the markers
fig.update_traces(
    marker=dict(
        symbol='circle',
        size= 10,
        color='black',
        )
)

# changed style of the markers
fig.update_traces(
    marker=dict(
        symbol='circle-open',
        size= 10,
        color='pink',
        line=dict(
            width=2,
        )
    )
)