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

Sorting categorical axes #3799

Open
poplarShift opened this issue Jun 28, 2019 · 4 comments
Open

Sorting categorical axes #3799

poplarShift opened this issue Jun 28, 2019 · 4 comments

Comments

@poplarShift
Copy link
Collaborator

@poplarShift poplarShift commented Jun 28, 2019

Following up on holoviz/hvplot#122, I think we should first decide if ordering is a part of the dimension declaration or of the styling options.

One solution would be, first of all, to respect the ordering of the hv.Dimension(values= ) kwarg, that's not too hard I guess.

Beyond that, if we wanted to have ordering by, say, alphabetical, inverse alphabetical, length of label, whatever, or mean/max/etc, would that live in the styling options with a hook into redimensioning the values= kwarg accordingly? Or something different?

@philippjfr

This comment has been minimized.

Copy link
Member

@philippjfr philippjfr commented Jul 3, 2019

Respecting values should definitely be done, that is already outlined in #2468. Beyond that we definitely need some discussion and I wouldn't be opposed to some options to determine that. In the case of a categorical axis it may not be too weird to use xlim/ylim to set an explicit ordering for example.

@poplarShift

This comment has been minimized.

Copy link
Collaborator Author

@poplarShift poplarShift commented Jul 4, 2019

Hm, I hadn't seen #3675. On the other hand I was sure I'd tested the functionality more recently than that and it still wasn't working in my case. Will have to investigate again.

@philippjfr

This comment has been minimized.

Copy link
Member

@philippjfr philippjfr commented Jul 4, 2019

On the other hand I was sure I'd tested the functionality more recently than that and it still wasn't working in my case

It's definitely not implemented yet.

@DancingQuanta

This comment has been minimized.

Copy link
Contributor

@DancingQuanta DancingQuanta commented Oct 2, 2019

I have this sorting issues with NdLayout/HoloMap not respecting the sort order from the original dataset in xarray.Dataset.

I did write a workaround for the meantime

def odict_sort_by_list(d, sort_list):
    return type(d)((k, d[k]) for k in sort_list) 
plot.data = odict_sort_by_list(plot.data, list)

where list is a list converted from a xr.coordinates and plot is either HoloMap or NdLayout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.