Feature request: allow string formatting for values in subsets
slochower opened this issue · comments
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.
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.
Now available in v0.0.5 with the transform
parameter:
transform={"Solubility": lambda x: f"{x:.2f}"}
Looks great! 🎉