python - set axis limits on individual facets of seaborn facetgrid -


i'm trying set x-axis limits different values each facet seaborn facetgrid distplot. understand can access axes within subplots through g.axes, i've tried iterate on them , 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)     i, ax in enumerate(g.axes.flat): # set every-other axis testing purposes         if % 2 == 0[enter link description here][1]:             ax.set_xlim(-400,500)         else:             ax.set_xlim(-200,200) 

however, when this, axes set (-200, 200) not every other facet.

what doing wrong?

mwaskom had solution; posting here completeness - had change following line to:

g = sns.facetgrid(mapping, col=options.facetcol, row=options.facetrow, col_order=sorted(cols), hue=options.group, sharex=false) 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -