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 step histogram endline #2372

Merged
merged 2 commits into from Sep 9, 2013
Merged

Conversation

neggert
Copy link
Contributor

@neggert neggert commented Sep 3, 2013

Fix #2365.

This was a simple off-by-one error (hat tip to @nicolaschotard for finding the bug as well as reporting it). I added a new test that should catch this if it pops up again.

@mdboom
Copy link
Member

mdboom commented Sep 3, 2013

👍 Any chance you could just use png for test? I don't think there's much benefit to testing all 3 here, and we're trying to limit the number of tests we accumulate over time. Or, better yet, is there way to modify an existing test to show off this problem?

@nicolaschotard
Copy link

Hi,

I'm actually not sure that the fix really solved the problem. The endline is now a bit too long and goes on the left, on the x axis. It is also present on the png you gave if you look closely.

Cheers,

Nicolas

@neggert
Copy link
Contributor Author

neggert commented Sep 6, 2013

Ah, you are indeed correct. I'll have to dig into this a little more. The fancy indexing in this chunk of code is pretty hairy.

@nicolaschotard
Copy link

A simple "+2" instead of "+1" works for me (split = int(len(x) / 2) + 2 ), but I did not check if this is a robust fix...

@neggert
Copy link
Contributor Author

neggert commented Sep 6, 2013

Given the complexity, I think I need to go through and fully analyze that bit of code. The other thing that's been puzzling me is that the problem doesn't show up when you plot multiple datasets, as far as I can tell.

@neggert
Copy link
Contributor Author

neggert commented Sep 6, 2013

Alright, after reloading the entire thing into my brain and drawing myself a picture, I figured out what was going on. This should be correct. I also fixed a couple other oddities which gave results that were incorrect, but not visibly so.

@mdboom Any idea how I remove the .pdf and .svg from the test? The basic @image_comparison decorator automatically generates all three.

@@ -1062,6 +1062,17 @@ def test_hist_offset():
ax.hist(d2, bottom=15)


@image_comparison(baseline_images=['hist_step'])
Copy link
Member

Choose a reason for hiding this comment

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

Stick an extensions=['png'] in here so that we don't get extraneous images being generated. Also, if you wouldn't mind, stick in a remove_text=True too.

@neggert
Copy link
Contributor Author

neggert commented Sep 9, 2013

I removed the svg and pdf in the test.

dmcdougall added a commit that referenced this pull request Sep 9, 2013
@dmcdougall dmcdougall merged commit 637a565 into matplotlib:v1.3.x Sep 9, 2013
@neggert neggert deleted the hist_endline_fix branch September 9, 2013 15:09
@mdboom
Copy link
Member

mdboom commented Sep 9, 2013

@neggert: Sorry I didn't get back to you sooner. I see you've figured it out in the meantime. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants