Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dstansby
Copy link
Member

@dstansby dstansby commented Nov 1, 2017

Fixes #5898. Hopefully the comment I've added in the code should make it clear what's going on.

self._process_unit_info(xdata=x[0], kwargs=kwargs)
newx = []
for xi in x:
newx.append(self.convert_xunits(xi))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x = [self.convert_xunits(xi) for xi in x] ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️ thanks...


# Process unit information
# If doing a stacked histogram, the input is a list of datasets, so
# we need to do the unit conversion individually on eaach dataset
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each

@dstansby dstansby added this to the v2.2 milestone Nov 4, 2017
Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing something, but it looks like this is not handling all the cases it should.

# we need to do the unit conversion individually on each dataset
if stacked:
self._process_unit_info(xdata=x[0], kwargs=kwargs)
x = [self.convert_xunits(xi) for xi in x]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand: it seems to me that the criterion for needing this step is not whether the histogram is stacked, but whether x is a list of datasets.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right, I'll change this and add a test for multiple datasets that aren't stacked

Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think I see one more detail.

# Massage 'x' for processing.
if input_empty:
x = np.array([[]])
x = [np.array([[]])]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many square brackets--I think this should be a list with one empty 1-D array, not with an empty 2-D array.

@efiring efiring merged commit 905465b into matplotlib:master Nov 14, 2017
@dstansby dstansby deleted the stacked-datetime branch November 14, 2017 19:53
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants