-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
'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
Conversation
'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
Notice: |
ax.add_collection(rangeCollection) | ||
ax.add_collection(barCollection) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
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.
There was a problem hiding this comment.
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,
There was a problem hiding this comment.
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.
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. |
The Travis failure is unrelated. |
what do you guys mean by 'deprecated' ? Is it abandoned or move to another place and renamed? |
By 'deprecated' we mean 'slated for removal'. @efiring described the current state well. |
👍 on fixing this (this is my mistake, sorry). |
@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. |
🎉 @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? |
@tacaswell Thanks, guys~ the very first contribution of my life... |
If you guys wouldn't complain about my low speed of progress, I'm fine with it. |
Good! (Well, not good that there are more bugs, but very good that you are willing to hunt them down and fix them.) |
8000 FIX: 'closes' and 'lows' misplaced in candlestick chart
backported to 1.5.x as ff40b7e |
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:

after:
