已解决AttributeError: Unknown property axisbg
文章目录
- 报错问题
- 解决方法
- 声明
报错问题
之前在工作中遇到过这个坑,记录一下问题以及解决方法,不一定针对所有情况都能用,但是可以供大家参考。
问题描述如下:
raise AttributeError(‘Unknown property %s’ % k)
AttributeError: Unknown property axisbg
引发属性错误(“未知属性%s”%k)
属性错误:未知属性axisbg
解决方法
在matplotlib.pyplot.subplot2grid()的属性栏里面已经没有了axisbg这个参数,根据matplotlib 2.2.0的API,
Color of Axes
The axisbg and axis_bgcolor properties on Axes have been deprecated in favor of facecolor.
得知,曾经包含的属性axisbg已经被facecolor所替换:
ax = plt.subplot2grid((2,1), (1,0), rowspan=4, colspan=4, facecolor=’#07000d’)
同样的,matplotlib里面也去掉了 finance包,现在有个独立的库 mpl_finance,如果想用原来finance库中的函数,比如 candlestick_ochl,就需要从mpl_finance中导入了。
声明
解决方法参考网络,如有侵权联系我删除