plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
16.21k stars 2.55k forks source link

some columns do not appear in hover if using labels overrides already used common names in Plotly Express #2562

Open emmanuelle opened 4 years ago

emmanuelle commented 4 years ago

Should we raise a warning or an error in the following case (which is very contrived of course)

import plotly.express as px
df = px.data.tips()
fig = px.scatter(df, x='tip', y='total_bill', color='day', facet_col='sex',
                 labels={'tip':'sex', 'day':'sex'})
fig.show()

in this case, in the hover only the value corresponding to x='tip' appears.

nicolaskruchten commented 4 years ago

it's actually worse: the legend can get messed up also:

px.scatter(px.data.tips(), 
           x="total_bill", y="tip", 
           facet_row="day", facet_col="time", 
           symbol="sex", color="smoker", size="size",
          labels={x:"label" for x in px.data.tips().columns})

image