8000 implemented the wrappers discussed in #1783. · tacaswell/matplotlib@82e9a9f · GitHub
[go: up one dir, main page]

Skip to content

Commit 82e9a9f

Browse files
committed
implemented the wrappers discussed in matplotlib#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 3c42826 commit 82e9a9f

File tree

1 file changed

+55
-3
lines changed

1 file changed

+55
-3
lines changed

lib/matplotlib/finance.py

Lines changed: 55 additions & 3 deletions
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
configdir = get_configdir()
3132
# cachedir will be None if there is no writable directory.
@@ -77,7 +78,7 @@ def parse_yahoo_historical(fh, adjusted=True, asobject=False):
7778
7879
Otherwise return a numpy recarray with
7980
80-
date, year, month, day, d, open, high, low, close,
81+
date, year, month, day, d, open, high, low, close,
8182
volume, adjusted_close
8283
8384
where d is a floating poing representation of date,
@@ -151,7 +152,7 @@ def fetch_historical_yahoo(ticker, date1, date2, cachename=None,dividends=False)
151152
cachename is the name of the local file cache. If None, will
152153
default to the md5 hash or the url (which incorporates the ticker
153154
and date range)
154-
155+
155156
set dividends=True to return dividends instead of price data. With
156157
this option set, parse functions will not work
157158
@@ -374,9 +375,60 @@ 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,
379+
colorup='k', colordown='r',
380+
):
381+
"""
382+
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,
378429
colorup='k', colordown='r',
379430
):
431+
380432
"""
381433
382434
Represent the time, open, high, low, close as a vertical line

0 commit comments

Comments
 (0)
0