Showlegend not working

Hello,
Showlegend in plotly.update_layout() is not working . I had also tried layout.update, update(layout=dict()) methods too.
I am using a dev container of custom tensorflow

fig = px.scatter(temp_na,x='date',y=[1]*temp_na.shape[0],title="Dates at which experiments have been carried out",color=year_col,color_continuous_scale=px.colors.qualitative.Plotly)
fig.update_layout(showlegend=False)
fig.update_yaxes(title="",zeroline=False,showticklabels=False)
fig.show()

btw its working with graph_objects. maybe its inconsistent when i give px a color argument?

Yes, the syntax is slightly different when using express / graph_objects.

Plotly express is using graph_objects under the hood. As for the color parameter: this creates different traces. You can see this if you plot the figure object: print(fig.to_dict())

What exactly are you trying to achieve?

1 Like

I am trying to get rid of the legend(the continuous color column)

Hey @H4CK3R , try this:

fig.update_layout(coloraxis_showscale=False)

If this does not work for you, please add the code + data (or equvalent data) to reproduce your plot.

hurray…actually i proceeded to do in graph_objects, but seeing this is just a simple solution i will use this. with this i can get rid of almost 6 line of code
Thankyou very much mate
best regards

1 Like