@@ -223,6 +223,9 @@ def _valid_plot_kwargs():
223
223
224
224
'return_width_config' : { 'Default' : None ,
225
225
'Validator' : lambda value : isinstance (value ,dict ) and len (value )== 0 },
226
+
227
+ 'saxbelow' : { 'Default' : True , # Issue#115 Comment#639446764
228
+ 'Validator' : lambda value : isinstance (value ,bool ) },
226
229
}
227
230
228
231
_validate_vkwargs_dict (vkwargs )
@@ -312,7 +315,6 @@ def plot( data, **kwargs ):
312
315
formatter = IntegerIndexDateTimeFormatter (new_dates , fmtstring )
313
316
xdates = np .arange (len (new_dates ))
314
317
315
-
316
318
if collections is not None :
317
319
for collection in collections :
318
320
axA1 .add_collection (collection )
@@ -342,17 +344,17 @@ def plot( data, **kwargs ):
342
344
else :
343
345
axA1 .plot (xdates , mavprices )
344
346
347
+ avg_dist_between_points = (xdates [- 1 ] - xdates [0 ]) / float (len (xdates ))
345
348
if not config ['tight_layout' ]:
346
- avg_dist_between_points = (xdates [- 1 ] - xdates [0 ]) / float (len (xdates ))
347
349
#print('plot: xdates[-1]=',xdates[-1])
348
350
#print('plot: xdates[ 0]=',xdates[ 0])
349
351
#print('plot: len(xdates)=',len(xdates))
350
352
#print('plot: avg_dist_between_points =',avg_dist_between_points)
351
353
minx = xdates [0 ] - avg_dist_between_points
352
354
maxx = xdates [- 1 ] + avg_dist_between_points
353
355
else :
354
- minx = xdates [0 ]
355
- maxx = xdates [- 1 ]
356
+ minx = xdates [0 ] - ( 0.45 * avg_dist_between_points )
357
+ maxx = xdates [- 1 ] + ( 0.45 * avg_dist_between_points )
356
358
357
359
if len (xdates ) == 1 : # kludge special case
358
360
minx = minx - 0.75
@@ -376,7 +378,8 @@ def plot( data, **kwargs ):
376
378
axA1 .set_ylim (config ['set_ylim' ][0 ], config ['set_ylim' ][1 ])
377
379
elif config ['tight_layout' ]:
378
380
axA1 .set_xlim (minx ,maxx )
379
- axA1 .set_ylim (miny ,maxy )
381
+ ydelta = 0.01 * (maxy - miny )
382
+ axA1 .set_ylim (miny - ydelta ,maxy + ydelta )
380
383
else :
381
384
corners = (minx , miny ), (maxx , maxy )
382
385
axA1 .update_datalim (corners )
@@ -616,7 +619,13 @@ def plot( data, **kwargs ):
616
619
volumeAxes .set_ylabel (vol_label )
617
620
618
621
if config ['title' ] is not None :
619
- fig .suptitle (config ['title' ],size = 'x-large' ,weight = 'semibold' )
622
+ if config ['tight_layout' ]:
623
+ # IMPORTANT: 0.89 is based on the top of the top panel
624
+ # being at 0.18+0.7 = 0.88. See _panels.py
625
+ # If the value changes there, then it needs to change here.
626
+ fig .suptitle (config ['title' ],size = 'x-large' ,weight = 'semibold' , va = 'bottom' , y = 0.89 )
627
+ else :
628
+ fig .suptitle (config ['title' ],size = 'x-large' ,weight = 'semibold' , va = 'center' )
620
629
621
630
for panid ,row in panels .iterrows ():
622
631
if not row ['used2nd' ]:
0 commit comments