FIX: missing color bar when direction flipped#341
Merged
Conversation
cfarrow
suggested changes
Feb 28, 2017
| mapper = self.index_mapper | ||
|
|
||
| scrn_points = arange(mapper.low_pos, mapper.high_pos+1) | ||
| direction = 1 if self.direction == 'normal' else -1 |
There was a problem hiding this comment.
This does not do the right thing for flipped bounds. For example, for
low_pos = 1
high_pos = -1this gives
array([1])I suggest,
low = mapper.low_pos
high = mapper.high_pos
if self.direction == 'flipped':
low, high = high, low
scrn_points = arange(low, high + 1)and then delete lines 155-156, which would undo the bounds flip.
jwiggins
approved these changes
Mar 5, 2017
| direction = 1 if self.direction == 'normal' else -1 | ||
| scrn_points = arange( | ||
| mapper.low_pos, mapper.high_pos + 1, direction | ||
| ) |
Member
There was a problem hiding this comment.
What about the mapper.high_pos + 1 bit? Won't that need to change when the direction is flipped as well?
cfarrow
approved these changes
Mar 6, 2017
Contributor
Author
Member
|
Sorry, I ran into enthought/enable#266 when I was trying to test this. I've now tested it. LGTM! |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #311. The

arangeproduced an empty array when thedirectionattribute is set toflippedsincemapper.low_pos > mapper.high_pos. This PR tellsarangeto descend when using theflippeddirection rather than ascend. Here is the example from #311 before:and after:
