【发布时间】:2021-02-28 18:18:32
【问题描述】:
我正在尝试根据我的值的 interval_size 广告颜色条,在尝试使用 seaborn 绘图时遇到以下错误:
AttributeError: 'AxesSubplot' object has no attribute 'get_array'
当前剧情
想要的情节
数据表
min max y interval_size y_pred split
0.654531 1.021657 0.837415 0.367126 0.838094 train
0.783401 1.261898 1.000000 0.478497 1.022649 valid
-0.166070 0.543749 0.059727 0.709819 0.188840 train
0.493270 1.112610 0.504393 0.619340 0.802940 valid
0.140510 0.572957 0.479063 0.432447 0.356734 train
绘图代码
plt.figure(figsize=(16,8))
plots = sns.scatterplot(x="y",
y="y_pred",
#size= "interval_size",
data=df,
alpha=0.65,
c=df['interval_size'],
cmap='viridis',
#hue = 'split',
s = (df['interval_size']**2)*50,
style = 'split',
markers = {'train': '^', 'valid':'8'}
)
# Put the legend out of the figure
#plt.legend(bbox_to_anchor=(1.01, 1),borderaxespad=0, title='Data Split', fontsize=20)
##Add Colorbar
plt.colorbar(plots)
#Plot Characteristics
plt.title("Stability: True vs Predicted Labels", fontsize = 36)
plt.xlabel("True Labels", fontsize = 25)
plt.ylabel("Predicted Labels", fontsize = 25)
【问题讨论】:
标签: python matplotlib seaborn bubble-chart