Label alias not working for color bar (plotly express)

Hello everyone, currently I am having issues with labelalias not being recognized. I am trying to update the label alias of a color bar legend on the side. However it does not seem to be working, despite the fact that I am on a version compatible with labelalias (5.9.0). To add to the confusion, my code seems to be working fine on google colab but not on dash in vscode.

I have been receiving this error message:

ValueError: Invalid property specified for object of type plotly.graph_objs.scatter.marker.ColorBar: β€˜labelalias’

Here is the code snippet:

legendFig = px.scatter(df_melted, x="value", facet_col_spacing=0.04, y="y", facet_col="feature", facet_col_wrap=2,custom_data=['rank'],  category_orders={ 
                                    "feature": [feature + "_v" for feature in features]})
legendFig.update_traces(
                    hoverinfo='skip',
                    opacity=0,
                    marker=dict(
                                    color=df_melted["rank"],
                                    showscale=True,
                                    colorbar=dict(
                                        title="Rank",
                                        tickmode="array",
                                        tickvals=tickVal,
                                        labelalias={1: '429', 250: '250', 429: '1'}
                                    )
                                ))

If anyone can give me any insight as to why this isn’t working it’d be greatly appreciated!

edit: I added bug-reporter to the tags, just incase this is potentially a bug.

Hi @Conor ,

Try to jump into the link below. The label aliases has been released on Plotly v5.15.0.
I think you need upgrade from 5.9 to 5.15.

Hope this help.

1 Like