Hide legend in plotly express

I have a scatteplot Iโ€™m trying to present, with lots of symbols and colors. This makes the default legend unreadable.
Is there a way to hide the legend (equivalent, or similar to showlegend=False when using traces and graph objects)?

Hereโ€™s my graphing line:
fig = px.scatter(df_revised, x='df_x', y = 'df_y', color = 'type', symbol = 'country', hover_data = ['id'], marginal_y="histogram", marginal_x="histogram")

Try fig.update_layout(showlegend=False) :slight_smile:

4 Likes

Nope, thatโ€™s not working.
AttributeError: 'ExpressFigure' object has no attribute 'update_layout'

Maybe .layout.update() works then

Yup, that worked. Thanks :slight_smile:

1 Like