Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python AttributeError:未知属性axisbg_Python_Matplotlib_Runtime Error_Data Visualization_Attributeerror - Fatal编程技术网

Python AttributeError:未知属性axisbg

Python AttributeError:未知属性axisbg,python,matplotlib,runtime-error,data-visualization,attributeerror,Python,Matplotlib,Runtime Error,Data Visualization,Attributeerror,下面是我试图运行的代码: ax = plt.axes(axisbg='#E6E6E6') ax.set_axisbelow(True) plt.grid(color='w',linestyle='solid') for spine in ax.spines.values(): spine.set_visible(False) ax.xaxis.tick_bottom() ax.yaxis.tick_left() ax.tick_params(colors='gray',directi

下面是我试图运行的代码:

ax = plt.axes(axisbg='#E6E6E6')
ax.set_axisbelow(True)
plt.grid(color='w',linestyle='solid')

for spine in ax.spines.values():
   spine.set_visible(False)

ax.xaxis.tick_bottom()
ax.yaxis.tick_left()

ax.tick_params(colors='gray',direction='out')
for tick in ax.get_xticklabels():
   tick.set_color('gray')
for tick in ax.get_yaxislabels():
   tick.set_color('gray')

ax.hist(x,edgecolor='E6E6E6',color='E6E6E6');
错误是:AttributeError:Unknown property axisbg


请帮助我识别错误。

axisbg在matplotlib 2.0中不受欢迎+ 改用facecolor


替换下面的代码行

ax = plt.axes(axisbg='#E6E6E6')


这可能会让你看到自己回购协议的链接总是很有趣。但是是的:
axisbg
被弃用,取而代之的是
facecolor
ax = plt.axes(facecolor='#E6E6E6')