【发布时间】:2019-06-29 14:53:29
【问题描述】:
我尝试使用以下代码绘制子图。但我得到了'AttributeError: 'numpy.ndarray' object has no attribute 'boxplot'。
但更改 plt.subplots(1,2) 它正在绘制带有 indexerror 的箱线图。
import matplotlib.pyplot as plt
import seaborn as sns
fig = plt.Figure(figsize=(10,5))
x = [i for i in range(100)]
fig , axes = plt.subplots(2,2)
for i in range(4):
sns.boxplot(x, ax=axes[i])
plt.show();
我预计应该绘制四个子图,但 AttributeError 正在抛出
【问题讨论】:
标签: python python-3.x matplotlib