Skip to content

Label aliases does not work at MacOS #4173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MorozovG opened this issue Apr 23, 2023 · 4 comments
Closed

Label aliases does not work at MacOS #4173

MorozovG opened this issue Apr 23, 2023 · 4 comments

Comments

@MorozovG
Copy link

The example provided in the documentation for Label Aliases does not work as expected at MacOS.

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()

This is how it should look like:
image
And what it looks like when I run the code:
image
Plotly version - 5.14.1. Python 3.11.3

@joseabautista
Copy link

I have this same problem.

Tested on a MacOS Ventura 13.3.1 with an M1 chip, both on a Jupyter notebook and through Plotly.js (integrated with Dash). Both Python and JS versions of Plotly are the latest available (5.14.1 for Python, and 2.21 for JS). Python version is 3.10.8.

@alexcjohnson
Copy link
Collaborator

Works for me, in Jupyter on a Mac, Py3.10. Note that the plotly.js version that's currently included in plotly.py is 2.20.0 but that's sufficient to support labelalias:
Screenshot 2023-04-26 at 09 45 21
Screenshot 2023-04-26 at 09 54 10

I know it's frustratingly unclear which version of a package you'll load in Jupyter, can you confirm that you indeed have the latest?

@MorozovG
Copy link
Author

Yes. The problem was in vscode. It uses an old version of plotly.js. This is what helped:

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

#3488 (comment)
microsoft/vscode-jupyter#8373

@gvwilson
Copy link
Contributor

Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants