【问题标题】:KeyError when bbox_inches='tight' in mplfinance plotmplfinance 图中 bbox_inches='tight' 时的 KeyError
【发布时间】:2021-09-16 21:22:29
【问题描述】:

我有以下代码: 从 pandas_datareader 以 web 形式导入数据

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"'

我怎样才能使利润紧缩?

【问题讨论】:

    标签: python python-3.x keyerror mplfinance


    【解决方案1】:

    使用 kwarg tight_layout=True

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

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

    【讨论】:

      猜你喜欢
      • 2012-10-12
      • 2014-10-30
      • 2013-04-08
      • 1970-01-01
      • 1970-01-01
      • 2013-10-20
      • 1970-01-01
      • 1970-01-01
      • 2018-01-04
      相关资源
      最近更新 更多