How to set some xlim and ylim in Seaborn lmplot facetgrid

前端 未结 2 950
醉酒成梦
醉酒成梦 2020-11-29 18:37

I\'m using Seaborn\'s lmplot to plot a linear regression, dividing my dataset into two groups with a categorical variable.

For both x and y, I\'d like to manually se

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 19:19

    You need to get hold of the axes themselves. Probably the cleanest way is to change your last row:

    lm = sns.lmplot('X','Y',df,col='Z',sharex=False,sharey=False)
    

    Then you can get hold of the axes objects (an array of axes):

    axes = lm.axes
    

    After that you can tweak the axes properties

    axes[0,0].set_ylim(0,)
    axes[0,1].set_ylim(0,)
    

    creates:

    enter image description here

提交回复
热议问题