@@ -225,9 +225,11 @@ def plot( data, **kwargs ):
225
225
if apdict ['panel' ] == 'lower' :
226
226
need_lower_panel = True
227
227
break
228
+
229
+ ptype = config ['type' ]
228
230
229
231
# fig.add_axes( [left, bottom, width, height] ) ... numbers are fraction of fig
230
- if need_lower_panel or config ['volume' ]:
232
+ if need_lower_panel or config ['volume' ] and ptype is not 'renko' :
231
233
ax1 = fig .add_axes ( [0.15 , 0.38 , 0.70 , 0.50 ] )
232
234
ax2 = fig .add_axes ( [0.15 , 0.18 , 0.70 , 0.20 ], sharex = ax1 )
233
235
plt .xticks (rotation = 45 ) # must do this after creation of axis, and
@@ -258,7 +260,7 @@ def plot( data, **kwargs ):
258
260
else :
259
261
fmtstring = '%b %d'
260
262
261
- ptype = config [ 'type' ]
263
+
262
264
263
265
if ptype is not 'renko' :
264
266
if config ['show_nontrading' ]:
@@ -282,8 +284,8 @@ def plot( data, **kwargs ):
282
284
collections = _construct_ohlc_collections (xdates , opens , highs , lows , closes ,
283
285
marketcolors = style ['marketcolors' ] )
284
286
elif ptype == 'renko' :
285
- renko_params = _process_kwargs (kwargs ['renko_params' ], _valid_renko_kwargs ())
286
- collections , new_dates = _construct_renko_collections (dates , renko_params , closes ,
287
+ renko_params = _process_kwargs (kwargs ['renko_params' ] if 'renko_params' in kwargs else dict () , _valid_renko_kwargs ())
288
+ collections , new_dates = _construct_renko_collections (dates , highs , lows , renko_params , closes ,
287
289
marketcolors = style ['marketcolors' ] )
288
290
289
291
formatter = IntegerIndexDateTimeFormatter (new_dates , fmtstring )
@@ -318,6 +320,7 @@ def plot( data, **kwargs ):
318
320
else :
319
321
ax1 .plot (xdates , mavprices )
320
322
323
+
321
324
if ptype == 'renko' :
322
325
ax1 .autoscale ()
323
326
else :
@@ -329,7 +332,7 @@ def plot( data, **kwargs ):
329
332
corners = (minx , miny ), (maxx , maxy )
330
333
ax1 .update_datalim (corners )
331
334
332
- if config ['volume' ]:
335
+ if config ['volume' ] and ptype is not 'renko' :
333
336
vup ,vdown = style ['marketcolors' ]['volume' ].values ()
334
337
#-- print('vup,vdown=',vup,vdown)
335
338
vcolors = _updown_colors (vup , vdown , opens , closes , use_prev_close = style ['marketcolors' ]['vcdopcod' ])
@@ -448,7 +451,7 @@ def plot( data, **kwargs ):
448
451
ax4 .yaxis .set_label_position ('right' )
449
452
ax4 .yaxis .tick_right ()
450
453
451
- if need_lower_panel or config ['volume' ]:
454
+ if need_lower_panel or config ['volume' ] and ptype is not 'renko' :
452
455
ax1 .spines ['bottom' ].set_linewidth (0.25 )
453
456
ax2 .spines ['top' ].set_linewidth (0.25 )
454
457
plt .setp (ax1 .get_xticklabels (), visible = False )
@@ -475,7 +478,7 @@ def plot( data, **kwargs ):
475
478
476
479
ax1 .set_ylabel (config ['ylabel' ])
477
480
478
- if config ['volume' ]:
481
+ if config ['volume' ] and ptype is not 'renko' :
479
482
ax2 .figure .canvas .draw () # This is needed to calculate offset
480
483
offset = ax2 .yaxis .get_major_formatter ().get_offset ()
481
484
ax2 .yaxis .offsetText .set_visible (False )
0 commit comments