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

Skip to content

Commit 8745e3a

Browse files
committed
implemented the wrappers discussed in #1783.
Added deprecation warning to `plot_day_summary2` and returned call signature to what it was. Added alias `plot_day_summary_ochl` with same call signature as `plot_day_summary2`. renamed the modified function to `plot_day_summary_ohlc`. The first two functions simply call the third with the arguments re-ordered.
1 parent 2c4727a commit 8745e3a

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

lib/matplotlib/finance.py

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from matplotlib.patches import Rectangle
2727
from matplotlib.transforms import Affine2D
2828

29+
from matplotlib import MatplotlibDeprecationWarning as mplDeprecation
2930

3031
cachedir = get_cachedir()
3132
# cachedir will be None if there is no writable directory.
@@ -374,11 +375,62 @@ def candlestick(ax, quotes, width=0.2, colorup='k', colordown='r',
374375
return lines, patches
375376

376377

377-
def plot_day_summary2(ax, opens, highs, lows, closes ticksize=4,
378+
def plot_day_summary2(ax, opens, closes, highs, lows, ticksize=4,
378379
colorup='k', colordown='r',
379380
):
380381
"""
381382
383+
Represent the time, open, close, high, low, as a vertical line
384+
ranging from low to high. The left tick is the open and the right
385+
tick is the close.
386+
387+
ax : an Axes instance to plot to
388+
ticksize : size of open and close ticks in points
389+
colorup : the color of the lines where close >= open
390+
colordown : the color of the lines where close < open
391+
392+
return value is a list of lines added
393+
"""
394+
395+
warnings.warn("This function has been deprecated in 1.3 in favor"
396+
"of `plot_day_summary_ochl`,"
397+
"which maintains the natural argument order,"
398+
"or `plot_day_summary_ohlc`,"
399+
"which uses the open-high-low-close order."
400+
"This function will be removed in 1.4", mplDeprecation)
401+
return plot_day_summary_ohlc(ax, opens, highs, lows, closes, ticksize,
402+
colorup, colordown)
403+
404+
405+
def plot_day_summary_ochl(ax, opens, closes, highs, lows, ticksize=4,
406+
colorup='k', colordown='r',
407+
):
408+
409+
"""
410+
411+
Represent the time, open, close, high, low, as a vertical line
412+
ranging from low to high. The left tick is the open and the right
413+
tick is the close.
414+
415+
ax : an Axes instance to plot to
416+
ticksize : size of open and close ticks in points
417+
colorup : the color of the lines where close >= open
418+
colordown : the color of the lines where close < open
419+
420+
return value is a list of lines added
421+
"""
422+
423+
return plot_day_summary_ohlc(ax, opens, highs, lows, closes, ticksize,
424+
colorup, colordown)
425+
426+
427+
428+
def plot_day_summary_ohlc(ax, opens, highs, lows, closes, ticksize=4,
429+
colorup='k', colordown='r',
430+
):
431+
432+
"""
433+
382434
Represent the time, open, high, low, close as a vertical line
383435
ranging from low to high. The left tick is the open and the right
384436
tick is the close.

0 commit comments

Comments
 (0)