-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Allow string formatting for labels #1140
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a useful feature to me (even if I have rarely if ever used labels
!).
I would have expected to be able to use formatting options like {Density:.2f}
except that it raised an error when I tried. We could merge this feature without support for that, it'd be far less useful though. If you try to implement it, I'd suggest leveraging:
'{a} {b}'.format(a=1)
raises aKeyError
, so you don't need to check whether some columns are wrongly typed/missing, it does it for you'{a} {b}'.format(a=1, b=2, c=3)
doesn't raise an error so you can pass all the columns data to.format
and it'll happily use only what it needs.
Closes #1095
I thought about putting this in holoviews, but passing format strings to vdims seems a tad strange...
hv.Labels(kdims=["x", "y"], vdims=["{x} {y}"])
, but passing it in hvplot feels natural