Skip to content

PLT: plot('line') or plot('area') produces wrong xlim in xaxis in 0.25.0 #27993

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

Merged
merged 17 commits into from
Aug 20, 2019

Conversation

charlesdong1991
Copy link
Member

@charlesdong1991 charlesdong1991 commented Aug 18, 2019

Due to previous PRs, there is an issue with xlim wrongly plotted for lines. I digged into database a bit, and found it also affects plot(kind='area') because they share the same LinePlot. And this issue is produced in both DataFrame and Series. Now looks like the issue is gone:
Screen Shot 2019-08-18 at 2 18 32 PM

Duplicated closed issue 27796 is solved as well:

Screen Shot 2019-08-18 at 2 18 44 PM

Also looks like issue in #25160 is gone as well.
Screen Shot 2019-08-18 at 2 41 22 PM

The same to #24784 looks like issue is also gone
Screen Shot 2019-08-18 at 8 03 56 PM

@charlesdong1991 charlesdong1991 changed the title Fix issue 27686 PLT: df.plot('line') has wrong xlim in xaxis in 0.25.0 Aug 18, 2019
@charlesdong1991 charlesdong1991 changed the title PLT: df.plot('line') has wrong xlim in xaxis in 0.25.0 PLT: plot('line') or plot('area') produces wrong xlim in xaxis in 0.25.0 Aug 18, 2019
@mroeschke mroeschke added the Visualization plotting label Aug 18, 2019
@codecov
Copy link

codecov bot commented Aug 19, 2019

Codecov Report

Merging #27993 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #27993      +/-   ##
==========================================
- Coverage   93.05%   93.04%   -0.01%     
==========================================
  Files         189      189              
  Lines       50058    50042      -16     
==========================================
- Hits        46581    46564      -17     
- Misses       3477     3478       +1
Flag Coverage Δ
#multiple 91.72% <100%> (ø) ⬆️
#single 42.5% <0%> (-0.08%) ⬇️
Impacted Files Coverage Δ
pandas/plotting/_matplotlib/tools.py 77.3% <ø> (-1.24%) ⬇️
pandas/plotting/_matplotlib/core.py 88.24% <100%> (+0.08%) ⬆️
pandas/io/gbq.py 88.88% <0%> (-11.12%) ⬇️
pandas/core/frame.py 97.13% <0%> (-0.12%) ⬇️
pandas/plotting/_matplotlib/converter.py 63.84% <0%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b0a2a6...6a64b7f. Read the comment docs.

@@ -419,6 +419,7 @@ def test_get_finder(self):
assert conv.get_finder("A") == conv._annual_finder
assert conv.get_finder("W") == conv._daily_finder

@pytest.mark.xfail # I am not sure if this test is correct
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you expand on this? Perhaps open a new issue with the description of the bug, and reference it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you post images of the output for one of the failing tests, before and after your changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

@TomAugspurger yes, i feel the best way is to xfail the tests here and open up a new issue and do a follow-up PR to fix the tests, Because the main purpose is to test if the finder is being correctly used or not. And I honestly do not understand especially the second one in which there is a vmin + 0.9, I assume that's because of this wrong xaxis output, so has to manually add a constant to match the behavior.

Copy link
Member Author

@charlesdong1991 charlesdong1991 Aug 19, 2019

Choose a reason for hiding this comment

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

After my change: (this is also aligned with the behaviour on matplotlib)

Screen Shot 2019-08-19 at 6 20 18 PM

Before my change:(i feel this is a bit wrong, because plot should start from 1987Q2, while due to this error, it starts from Q3 IIUC)

Screen Shot 2019-08-19 at 6 18 23 PM

@TomAugspurger

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks... I think I agree with your assessment.

Can you open a new issue to discuss removing / updating those tests? And reference that in the skip / xfails?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, i was thinking of doing it, but then i thought this PR would become a blocker for the issue if it is not merged because the test has to use the output of this PR. Probably I just overthink it ^^ thanks, will open and reference it. @TomAugspurger

@TomAugspurger
Copy link
Contributor

Can you move the release note to 1.0.0.rst?

@TomAugspurger TomAugspurger merged commit 69c58da into pandas-dev:master Aug 20, 2019
@TomAugspurger
Copy link
Contributor

Thanks @charlesdong1991!

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