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

Skip to content

Commit 1351ec1

Browse files
committed
fixed a colorup/down bug in finance.py
svn path=/trunk/matplotlib/; revision=1860
1 parent 122eb6a commit 1351ec1

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2005-11-15 Fixed a colorup/colordown reversal bug in finance.py --
2+
Thanks Gilles
3+
14
2005-11-15 New entries should be added at the top 2005-08-14 Applied
25
Jouni K Steppanen's boxplot patch SF patch#1349997 - JDH
36

lib/matplotlib/finance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def plot_day_summary2(ax, opens, closes, highs, lows, ticksize=4,
266266
colord = { True : colorup,
267267
False : colordown,
268268
}
269-
colors = [colord[open>=close] for open, close in zip(opens, closes) if open!=-1 and close !=-1]
269+
colors = [colord[open<close] for open, close in zip(opens, closes) if open!=-1 and close !=-1]
270270

271271
assert(len(rangeSegments)==len(offsetsOpen))
272272
assert(len(offsetsOpen)==len(offsetsClose))
@@ -358,7 +358,7 @@ def candlestick2(ax, opens, closes, highs, lows, width=4,
358358
colord = { True : colorup,
359359
False : colordown,
360360
}
361-
colors = [colord[open>=close] for open, close in zip(opens, closes) if open!=-1 and close !=-1]
361+
colors = [colord[open<close] for open, close in zip(opens, closes) if open!=-1 and close !=-1]
362362

363363

364364
assert(len(barVerts)==len(rangeSegments))
@@ -424,7 +424,7 @@ def volume_overlay(ax, opens, closes, volumes,
424424
colord = { True : colorup,
425425
False : colordown,
426426
}
427-
colors = [colord[open>=close] for open, close in zip(opens, closes) if open!=-1 and close !=-1]
427+
colors = [colord[open<close] for open, close in zip(opens, closes) if open!=-1 and close !=-1]
428428

429429
right = width/2.0
430430
left = -width/2.0

0 commit comments

Comments
 (0)