8000 'closes' and 'lows' misplaced in candlestick chart by 4over7 · Pull Request #6869 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

'closes' and 'lows' misplaced in candlestick chart #6869

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 1 commit into from
Aug 2, 2016

Conversation

4over7
Copy link
Contributor
@4over7 4over7 commented Jul 31, 2016

This two function: candlestick2_ohlc() and candlestick2_ochl(), their parameter of open/high/low/close should preserve the order in the document.

for candlestick2_ohlc(), 'closes' and 'lows' are misplaced (exchanged) in candlestick2_ochl function, both in 1.5.1 and 2.* ( i don't know 1.4.* or below).

This bug will cause mistakes while ploting, see my answer to this question on stackoverflow: http://stackoverflow.com/a/38684513/4117822. Could any one VOTE-UP for me here? T_T

before:
rrdsi

after:
index

'closes' and 'lows' are misplaced in candlestick2_ochl function, both in 1.5.1 and 2.* ( i don't know 1.4.* or below). 
This bug will cause mistakes while ploting, see my answer to this question on stackoverflow: http://stackoverflow.com/a/38684513/4117822
 
I work 2 hours debuging in 2 a.m. could anybody who saw this vote me up here? T_T
@Kojoley
Copy link
Member
Kojoley commented Jul 31, 2016

Notice: finance module is deprecated and untested.

ax.add_collection(rangeCollection)
ax.add_collection(barCollection)
Copy link
Member

Choose a reason for hiding this comment

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

What is the reason for swapping the order here? I wouldn't expect it to make any difference, since the difference in zorder should determine the actual drawing order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

every line should be covered by correlative bar, and its part between 'open' and 'close' should not been seen. As showed below:
1 pic

logically, lines first, bars later. it's not enough, bars should be filled with color and cover lines. I'm just learning python here, so i don't know how to do a little further.

Copy link
Member

Choose a reason for hiding this comment

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

OK, that would be a good thing to fix. The way to do it is by setting the zorder kwarg of the barCollection to a value above that of the rangeCollection. Where the barCollection is created, add a line right before the ending curly brace:

zorder=rangeCollection.get_zorder() + 0.1,

Copy link
Member

Choose a reason for hiding this comment

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

@efiring how strongly do you feel about this? I am inclined to merge this as-is.

@efiring
Copy link
Member
efiring commented Jul 31, 2016

The finance module is badly in need of a maintainer, preferably someone who would break it out into a toolkit or a separate package, add tests, and foster its growth. Finance is an important area of matplotlib use--John D. Hunter himself worked in finance--so we don't like to see this functionality falling by the wayside. But none of the core developers happen to be in this field, and so far, no one from the community of users has stepped forward.

@efiring
Copy link
Member
efiring commented Jul 31, 2016

The Travis failure is unrelated.

@4over7
Copy link
Contributor Author
4over7 commented Aug 1, 2016

what do you guys mean by 'deprecated' ? Is it abandoned or move to another place and renamed?
Candlestick Plot and other things in Finance module is so important in Financial area. everyone needs this.

@tacaswell
Copy link
Member

By 'deprecated' we mean 'slated for removal'. @efiring described the current state well.

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Aug 1, 2016
@tacaswell
Copy link
Member

👍 on fixing this (this is my mistake, sorry).

@efiring
Copy link
Member
efiring commented Aug 2, 2016

@tacaswell, merging is fine. It can be backported to 1.5.x so as to appear in 1.5.3. It would be nice to get the zorder fix in as well, but it is not as critical as the fix that is already here.

@tacaswell tacaswell merged commit c5d7b60 into matplotlib:v2.x Aug 2, 2016
@tacaswell
Copy link
Member

🎉 @4over7 Thanks and congratulations on what I think is your first mpl contribution.

Are you at all interested in taking on maintenance of the finance module?

@QuLogic QuLogic modified the milestones: 2.0 (style change major release), 2.0.1 (next bug fix release) Aug 2, 2016
@4over7
Copy link
Contributor Author
4over7 commented Aug 3, 2016

@tacaswell Thanks, guys~ the very first contribution of my life...
I'd love to give more contribution, but a little worried because I'm still a newbie in python and programming. And I'm not familiar with Github too...

@4over7
Copy link
Contributor Author
4over7 commented Aug 3, 2016

If you guys wouldn't complain about my low speed of progress, I'm fine with it.
In fact, I found another bug to fix in Finance module yesterday.

@4over7 4over7 deleted the patch-1 branch August 3, 2016 05:13
@efiring
Copy link
Member
efiring commented Aug 3, 2016

Good! (Well, not good that there are more bugs, but very good that you are willing to hunt them down and fix them.)
In addition to one for the bug you just found, I think we need a PR for the zorder line I suggested, don't we? Without it, I think the lines will still land on top of the boxes.
I think @tacaswell will prefer that bug fixes are made against the master branch. Then they can be cherry-picked into another branch as needed.
See http://matplotlib.org/devdocs/devel/index.html for hints on working with mpl development. Don't hesitate to ask questions.

tacaswell added a commit that referenced this pull request Sep 8, 2016
8000
FIX: 'closes' and 'lows' misplaced in candlestick chart
@tacaswell
Copy link
Member

backported to 1.5.x as ff40b7e

@QuLogic QuLogic modified the milestones: v1.5.x, 2.0 (style change major release) Sep 9, 2016
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.

6 participants
0