Skip to content
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

Small spaced labels are not shown in legend #251

Closed
vascotenner opened this issue Aug 26, 2015 · 2 comments
Closed

Small spaced labels are not shown in legend #251

vascotenner opened this issue Aug 26, 2015 · 2 comments
Milestone

Comments

@vascotenner
Copy link
Contributor

When I have a holomap, where there are small differences in the elements of the kdims, and I create an Overlay, not all the elements are listed in the legend:

labels = [1.000,1.001,1.002]
hmap = hv.HoloMap([(label, hv.Curve([(label,label)])) for label in labels], kdims=['Test'])
hmap.overlay('Test')

screenshot

labels = [0,0.001,0.002]
hmap = hv.HoloMap([(label, hv.Scatter([(label,label)])) for label in labels], kdims=['Test'])
hmap.overlay('Test')

screenshot-1

While this works as expected: it shows all items in the legend.

I understand that it can be uggly to show long numbers, but if any round-off has to be done, better show three legend items.

Is there a way to customize this?

@philippjfr philippjfr added this to the v1.4.0 milestone Sep 11, 2015
@philippjfr
Copy link
Member

I'll be pushing a fix to this very soon. Basically Dimensions have had formatters and type_formatters for a while now but they were awkward to use because you always had to supply the formatter as a function. Now it accepts both string formatter styles. If you want to override the formatting applied to dimension values by type you can simply increase the number of significant figures you want printed:

Dimension.type_formatters[float] = "%.5g"
Dimension.type_formatters[np.float32] = "%.5g"
Dimension.type_formatters[np.float64] = "%.5g"

If you want to override the formatter for a specific Dimension you can just do this in your example:

labels = [0,0.001,0.002]
hmap = hv.HoloMap([(label, hv.Scatter([(label,label)])) for label in labels], kdims=[hv.Dimension('Test', formatter='%.8g')])
hmap.overlay('Test')

I'll close the issue as soon as I've pushed my changes.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants