6
我正在嘗試將x軸限制設置爲Seaborn facetgrid distplot的每個方面的不同值。我明白,我可以通過g.axes得到的次要情節中所有的軸連接,所以我試圖在它們之間迭代,並設置XLIM:在seaborn facetgrid的各個方面設置軸限制
g = sns.FacetGrid(mapping, col=options.facetCol, row=options.facetRow, col_order=sorted(cols), hue=options.group)
g = g.map(sns.distplot, options.axis)
for i, ax in enumerate(g.axes.flat): # set every-other axis for testing purposes
if i % 2 == 0[enter link description here][1]:
ax.set_xlim(-400,500)
else:
ax.set_xlim(-200,200)
然而,當我這樣做,所有的座標軸都被設置爲(-200,200)而不僅僅是其他方面。
我在做什麼錯?
如果要使軸具有不同的限制,則需要將'False'傳遞給'sharey'和'sharex'。 – mwaskom