-
Notifications
You must be signed in to change notification settings - Fork 28
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
Feature request: allow string formatting for values in subsets #10
Comments
Yep, that sounds like a good plan! |
What do you think about also allowing callbacks? You could check in your "what would run internally" code if the format is a string or a callable and apply .format if its a string or otherwise just hand it over to apply. That way, the format could be very flexible. |
fredrikw
pushed a commit
to fredrikw/mols2grid
that referenced
this issue
Apr 6, 2021
cbouy
pushed a commit
that referenced
this issue
Apr 7, 2021
* New `transform` parameter that accepts a dictionary of field-function items where each function transforms the input value that will be displayed. Co-authored-by: Fredrik Wallner <[email protected]> Co-authored-by: Cédric Bouysset <[email protected]>
Now available in v0.0.5 with the transform={"Solubility": lambda x: f"{x:.2f}"} |
Looks great! 🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks again.
It's really handy that you built-in CSS styling of the labels and tooltips, like
color: red
. It would also be great to support Python string formatting (e.g., to trim the string representation of floats). For example:I'm guessing this will be tricky since it looks like you're building up the CSS manually here:
mols2grid/mols2grid/molgrid.py
Line 316 in 849cf49
...but I think it's something to consider for the future.
The text was updated successfully, but these errors were encountered: