1
我的代码看起来像Seaborn显示一个barplot不是多个地块
ylst = [.1,.2,.3,.4,.5,.6,.7,.8]
xlst=["A","B","C","D","E","F","G","H"]
with PdfPages('probs.pdf') as pdf_pages:
for i in range(0,len(xlst), 2):
ax=sns.barplot(xlst[i:i+2], ylst[i:i+2])
ax.axes.set_title('Which name', fontsize=24,color="b",alpha=0.3)
ax.set_ylabel("Probability (%)",size = 17,color="r",alpha=0.5)
for p in ax.patches:
ax.annotate(str(p.get_height()), (p.get_x() * 1.005, p.get_height() * 1.005))
pdf_pages.savefig()
我想4个地块,在2行2列的矩阵。也就是说,左上角的图应该显示A
和B
,值为.1和.2。然后,左下角或右上角的图应显示值为.3和.4的C
和D
。等
不过,我反而得到的是:
我该如何解决这个问题?