KeyError when bbox_inches='tight' in mplfinance plot

KeyError when bbox_inches='tight' in mplfinance plot

我有以下代码: 来自 pandas_datareader 将数据导入为网络

import pandas as pd
from datetime import timedelta  
import mplfinance as mpf
import matplotlib as plt
df = web.DataReader('goog','yahoo', start="2021-07-3", end="2021-09-12")
mpf.plot(df, style='charles', type = 'candle', volume=True, figratio=(12,8), bbox_inches='tight')

bbox_inches='tight' 抛出错误:

KeyError: 'Unrecognized kwarg="bbox_inches"'

我怎样才能收紧利润?

使用 kwarg tight_layout=True.

如果这不能满足您的要求,您也可以尝试 kwarg scale_padding as described here.

bbox_inches 只能与 kwarg savefig kwarg 结合使用。 See here 了解详情。