Set axis limits in selected sections of the marine facet guide

I am trying to set the limits of the x axis for different values ​​for each grant a Seaborn facetgrid distplot. I understand that I can access all axes in the subheadings through g.axes, so I tried to iterate over them and set xlim with:

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) 

However, when I do this, all axes are set to (-200, 200) not only to any other face.

What am I doing wrong?

+6
source share
1 answer

mwaskom was the solution; placement here for completeness - you just had to change the following line:

 g = sns.FacetGrid(mapping, col=options.facetCol, row=options.facetRow, col_order=sorted(cols), hue=options.group, sharex=False) 
+9
source

All Articles