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

Fix GridSpace and GridMatrix sort=False #3769

Merged
merged 3 commits into from Jun 21, 2019

Conversation

@poplarShift
Copy link
Collaborator

commented Jun 12, 2019

Fixes #3462

Previously, sorted(set(...)) implicitly sorted grid keys, now passing sort=False has the intended effect:

import numpy as np
import holoviews as hv
hv.extension('matplotlib')

data = hv.Image(np.random.rand(10,10))
imgs = [
    (('C', 'dummy'), data),
    (('D', 'dummy'), data),
    (('A', 'dummy'), data),
    (('B', 'dummy'), data)
]
hv.GridSpace(imgs, sort=False, kdims=['dim1','dim2'])

Screen Shot 2019-06-12 at 12 29 10 PM

Screen Shot 2019-06-12 at 12 29 31 PM

#3770 is vaguely related (this PR highlights some code duplication) in the (non-) sorting of dimension values.

@poplarShift poplarShift added the bug label Jun 12, 2019

@philippjfr

This comment has been minimized.

Copy link
Contributor

commented Jun 21, 2019

There does seem to be a real failure in the Python 2 tests. Presumably something to do with dict ordering? Can't wait to drop py2 support.

@poplarShift

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 21, 2019

Great,

print(sorted(set(('c', 'b'))))
print(list(dict.fromkeys(('c', 'b'))))

print(sorted(set(('b', 'c'))))
print(list(dict.fromkeys(('b', 'c'))))

Yields

['b', 'c']
['c', 'b']
['b', 'c']
['b', 'c']

in python 3

but

['b', 'c']
['c', 'b']
['b', 'c']
['c', 'b']

in python 2!

@poplarShift

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 21, 2019

So, that should do the trick I hope...

@philippjfr philippjfr merged commit b78a1a5 into master Jun 21, 2019

3 of 4 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 87.746%
Details

@philippjfr philippjfr deleted the grid_nosort branch Aug 5, 2019

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