Skip to content

Formatting and hiding hover_data in PX #1774

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
nicolaskruchten opened this issue Sep 16, 2019 · 11 comments · Fixed by #2377
Closed

Formatting and hiding hover_data in PX #1774

nicolaskruchten opened this issue Sep 16, 2019 · 11 comments · Fixed by #2377
Assignees

Comments

@nicolaskruchten
Copy link
Contributor

Let's implement the API from plotly/plotly_express#115 and support False as a value so as to support plotly/plotly_express#120.

@emmanuelle
Copy link
Contributor

For the format of hover_data, would you prefer

  • accepting a dict, in which case all keys must have a value, eg hover_data={'species':None, 'petal_length':'%s"}
  • or keeping a list, and the element of the list can be either column names / columns / arrays, or tuples, eg hover_data=[('species', None), 'petal_length', ('petal_width', '%03d')] etc.

@nicolaskruchten
Copy link
Contributor Author

Ah, you mean how should a user be able to specify the formatting for some hover_data items but leave some as a default?

@emmanuelle
Copy link
Contributor

yes

@nicolaskruchten
Copy link
Contributor Author

Hmmm. And we need some pythonic way of distinguishing between "use the defaults" and "suppress this one"... Is None vs False clear enough? They're both falsey... "" has the same problem I think.

@emmanuelle
Copy link
Contributor

yes, this is why I was thinking of keeping a list but allowing tuple elements

@nicolaskruchten
Copy link
Contributor Author

Is this a common pattern in Python or... ? It makes sense but I've not seen it before.

@emmanuelle
Copy link
Contributor

hum, not really... let me think this over

@nicolaskruchten
Copy link
Contributor Author

I actually think saying "using "" as a dict value will use the default formatting" is OK. That's how plotly.js will treat it under the hood anyways, as far as I can tell

@nicolaskruchten
Copy link
Contributor Author

so None and False would suppress it and "" would not do any formatting. And/or we could add a px.DEFAULT magic-constant.

@JohnLarson775
Copy link

Any updates on this? I'm searching for a nice way to suppress certain items and keep redirecting back to this open issue.

@nicolaskruchten
Copy link
Contributor Author

This is not yet implemented, no but we'd happily accept a PR :)

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

Successfully merging a pull request may close this issue.

3 participants