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