@@ -312,7 +312,6 @@ def plot( data, **kwargs ):
312
312
formatter = IntegerIndexDateTimeFormatter (new_dates , fmtstring )
313
313
xdates = np .arange (len (new_dates ))
314
314
315
-
316
315
if collections is not None :
317
316
for collection in collections :
318
317
axA1 .add_collection (collection )
@@ -342,17 +341,17 @@ def plot( data, **kwargs ):
342
341
else :
343
342
axA1 .plot (xdates , mavprices )
344
343
344
+ avg_dist_between_points = (xdates [- 1 ] - xdates [0 ]) / float (len (xdates ))
345
345
if not config ['tight_layout' ]:
346
- avg_dist_between_points = (xdates [- 1 ] - xdates [0 ]) / float (len (xdates ))
347
346
#print('plot: xdates[-1]=',xdates[-1])
348
347
#print('plot: xdates[ 0]=',xdates[ 0])
349
348
#print('plot: len(xdates)=',len(xdates))
350
349
#print('plot: avg_dist_between_points =',avg_dist_between_points)
351
350
minx = xdates [0 ] - avg_dist_between_points
352
351
maxx = xdates [- 1 ] + avg_dist_between_points
353
352
else :
354
- minx = xdates [0 ]
355
- maxx = xdates [- 1 ]
353
+ minx = xdates [0 ] - ( 0.45 * avg_dist_between_points )
354
+ maxx = xdates [- 1 ] + ( 0.45 * avg_dist_between_points )
356
355
357
356
if len (xdates ) == 1 : # kludge special case
358
357
minx = minx - 0.75
@@ -376,7 +375,8 @@ def plot( data, **kwargs ):
376
375
axA1 .set_ylim (config ['set_ylim' ][0 ], config ['set_ylim' ][1 ])
377
376
elif config ['tight_layout' ]:
378
377
axA1 .set_xlim (minx ,maxx )
379
- axA1 .set_ylim (miny ,maxy )
378
+ ydelta = 0.01 * (maxy - miny )
379
+ axA1 .set_ylim (miny - ydelta ,maxy + ydelta )
380
380
else :
381
381
corners = (minx , miny ), (maxx , maxy )
382
382
axA1 .update_datalim (corners )
@@ -614,7 +614,13 @@ def plot( data, **kwargs ):
614
614
volumeAxes .set_ylabel (vol_label )
615
615
616
616
if config ['title' ] is not None :
617
- fig .suptitle (config ['title' ],size = 'x-large' ,weight = 'semibold' )
617
+ if config ['tight_layout' ]:
618
+ # IMPORTANT: 0.89 is based on the top of the top panel
619
+ # being at 0.18+0.7 = 0.88. See _panels.py
620
+ # If the value changes there, then it needs to change here.
621
+ fig .suptitle (config ['title' ],size = 'x-large' ,weight = 'semibold' , va = 'bottom' , y = 0.89 )
622
+ else :
623
+ fig .suptitle (config ['title' ],size = 'x-large' ,weight = 'semibold' , va = 'center' )
618
624
619
625
for panid ,row in panels .iterrows ():
620
626
if not row ['used2nd' ]:
0 commit comments