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
Post a Comment