|
13 | 13 | #from pandas.plotting import register_matplotlib_converters
|
14 | 14 | #register_matplotlib_converters()
|
15 | 15 |
|
16 |
| -from mplfinance._utils import _construct_ohlc_collections |
17 |
| -from mplfinance._utils import _construct_candlestick_collections |
18 |
| -from mplfinance._utils import _construct_renko_collections |
19 |
| -from mplfinance._utils import _construct_pointnfig_collections |
| 16 | +#from mplfinance._utils import _construct_ohlc_collections |
| 17 | +#from mplfinance._utils import _construct_candlestick_collections |
| 18 | +#from mplfinance._utils import _construct_renko_collections |
| 19 | +#from mplfinance._utils import _construct_pointnfig_collections |
20 | 20 | from mplfinance._utils import _construct_aline_collections
|
21 | 21 | from mplfinance._utils import _construct_hline_collections
|
22 | 22 | from mplfinance._utils import _construct_vline_collections
|
23 | 23 | from mplfinance._utils import _construct_tline_collections
|
| 24 | +from mplfinance._utils import _construct_mpf_collections |
24 | 25 |
|
25 | 26 | from mplfinance._utils import _updown_colors
|
26 | 27 | from mplfinance._utils import IntegerIndexDateTimeFormatter
|
@@ -186,7 +187,7 @@ def _valid_plot_kwargs():
|
186 | 187 | 'datetime_format' : { 'Default' : None,
|
187 | 188 | 'Validator' : lambda value: isinstance(value,str) },
|
188 | 189 |
|
189 |
| - 'x_rotation' : { 'Default' : None, |
| 190 | + 'xrotation' : { 'Default' : 45, |
190 | 191 | 'Validator' : lambda value: isinstance(value,(int,float)) },
|
191 | 192 | }
|
192 | 193 |
|
@@ -248,37 +249,22 @@ def plot( data, **kwargs ):
|
248 | 249 |
|
249 | 250 | ptype = config['type']
|
250 | 251 |
|
251 |
| - if ptype not in VALID_PMOVE_TYPES: |
252 |
| - if config['show_nontrading']: |
253 |
| - formatter = mdates.DateFormatter(fmtstring) |
254 |
| - xdates = dates |
255 |
| - else: |
256 |
| - formatter = IntegerIndexDateTimeFormatter(dates, fmtstring) |
257 |
| - xdates = np.arange(len(dates)) |
258 |
| - axA1.xaxis.set_major_formatter(formatter) |
| 252 | + if config['show_nontrading']: |
| 253 | + formatter = mdates.DateFormatter(fmtstring) |
| 254 | + xdates = dates |
| 255 | + else: |
| 256 | + formatter = IntegerIndexDateTimeFormatter(dates, fmtstring) |
| 257 | + xdates = np.arange(len(dates)) |
| 258 | + axA1.xaxis.set_major_formatter(formatter) |
259 | 259 |
|
260 | 260 | collections = None
|
261 |
| - if ptype == 'candle' or ptype == 'candlestick': |
262 |
| - collections = _construct_candlestick_collections(xdates, opens, highs, lows, closes, |
263 |
| - marketcolors=style['marketcolors'] ) |
264 |
| - elif ptype == 'ohlc' or ptype == 'bars' or ptype == 'ohlc_bars': |
265 |
| - collections = _construct_ohlc_collections(xdates, opens, highs, lows, closes, |
266 |
| - marketcolors=style['marketcolors'] ) |
267 |
| - elif ptype == 'renko': |
268 |
| - collections, new_dates, volumes, brick_values, size = _construct_renko_collections( |
269 |
| - dates, highs, lows, volumes, config['renko_params'], closes, marketcolors=style['marketcolors']) |
270 |
| - |
271 |
| - elif ptype == 'pnf': |
272 |
| - collections, new_dates, volumes, brick_values, size = _construct_pointnfig_collections( |
273 |
| - dates, highs, lows, volumes, config['pnf_params'], closes, marketcolors=style['marketcolors']) |
274 |
| - |
275 |
| - elif ptype == 'line': |
| 261 | + if ptype == 'line': |
276 | 262 | axA1.plot(xdates, closes, color=config['linecolor'])
|
277 |
| - |
278 | 263 | else:
|
279 |
| - raise ValueError('Unrecognized plot type = "'+ ptype + '"') |
| 264 | + collections =_construct_mpf_collections(ptype,dates,xdates,opens,highs,lows,closes,volumes,config,style) |
280 | 265 |
|
281 | 266 | if ptype in VALID_PMOVE_TYPES:
|
| 267 | + collections, new_dates, volumes, brick_values, size = collections |
282 | 268 | formatter = IntegerIndexDateTimeFormatter(new_dates, fmtstring)
|
283 | 269 | xdates = np.arange(len(new_dates))
|
284 | 270 | axA1.xaxis.set_major_formatter(formatter)
|
@@ -395,7 +381,8 @@ def plot( data, **kwargs ):
|
395 | 381 | maxy = config['set_ylim_panelB'][1]
|
396 | 382 | axB1.set_ylim( miny, maxy )
|
397 | 383 |
|
398 |
| - _adjust_ticklabels_per_bottom_panel(axA1,axB1,axC1,actual_order,hb,hc,formatter) |
| 384 | + xrotation = config['xrotation'] |
| 385 | + _adjust_ticklabels_per_bottom_panel(axA1,axB1,axC1,actual_order,hb,hc,formatter,xrotation) |
399 | 386 |
|
400 | 387 | used_axA2 = False
|
401 | 388 | used_axB2 = False
|
|
0 commit comments