属性错误:'NoneType'对象没有属性'remove'


ax.set_xlabel(var)
ax.set_ylabel('Density')
ax.legend_.remove()

#格式化绘图

plt.suptitle('Observation Compared to Test Distribution', y = 1.02, size = 20)
plt.tight_layout()
plt.show()

设置绘图格式

plt.suptitle('Observation Compared to Test Distribution', y = 1.02, size = 20)
plt.tight_layout()
plt.show()

***ERROR***
AttributeError                            Traceback (most recent call last)
~AppDataLocalTemp/ipykernel_2372/995712697.py in <module>
3 
4 test_index = 5
----> 5 investigate_obs(trace_log, X_test.iloc[test_index, :], y_test.values[test_index])
~AppDataLocalTemp/ipykernel_2372/214169725.py in investigate_obs(trace, obs, true_label, examine_pred)
52           ax.set_xlabel(var)
53           ax.set_ylabel('Density')
---> 54           ax.legend_.remove()
55 
56       # Format the plot
AttributeError: 'NoneType' object has no attribute 'remove'

根据我的说法,您使用的模块没有任何名为";移除";。

最新更新