Label Aliases wot working, plotly 5.14.1

Thank you very much for your work! Label Aliases is what I have been waiting for a long time. But, unfortunately, the example from the documentation does not work for me.

import plotly.express as px
import pandas as pd

df = px.data.tips()
df = df[df.day.isin(['Sat', 'Sun'])].groupby(by='day', as_index=False).sum(numeric_only=True)

fig = px.bar(df, x="day", y="total_bill")
fig.update_xaxes(labelalias=dict(Sat="Saturday", Sun="Sunday"))

fig.show()

Plotly version is 5.14.1. Help me please.

HI @Morozov welcome to the forums.

Can’t reproduce this with plotly 5.14.1, python 3.10.4 on linux.

Which OS do you use?

Hi @AIMPED. I am using MacOS. Python 3.11.3.

Exactly. When I run the code on linux everything works as it should. It turns out that the problem is only on macos.

1 Like

Thanks for the feedback, seems to be a bug then. I added the bug_reporter tag to the topic.

You could open an issue on github:

2 Likes

Thank you @AIMPED

Hi @Morozov
Let me know if you need help opening an issue in our repo.

Thank you @adamschroeder . I have already created an issue. Label aliases does not work at MacOS Β· Issue #4173 Β· plotly/plotly.py Β· GitHub

2 Likes

hi @Morozov

We tested it in MacOS, but it worked. Could it be related to the Python IDE that you’re using? Are you using VS Code?

Thanks a lot! The problem was in vscode. This is what helped:

import plotly.io as pio
pio.renderers.default = 'notebook'
1 Like