0

If I already make a plot, how to get axis limit from the existing plot so I can make some change for example, increase max limit by 10% etc?

for example, if I use seaborn lmplot and regplot like below. Thanks

sns.lmplot(x=x,y=y,data=data,fit_reg=False,legend=False,height=8, aspect=1.7, scatter_kws={"s": 200})
g=sns.regplot(x=x,y=y,data=data,ci=ci,scatter_kws={"s": 200,'alpha':0.1}, 
                     line_kws={'color':'green'})

Thanks

Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70
roudan
  • 3,082
  • 5
  • 31
  • 72
  • 1
    `g.get_xlim()` but `regplot` returns an `matplotlib.axes`, so it should be `ax = sns.regplot(...)` and `ax.get_xlim()`. `g = ` is used plots that return a seaborn FacetGrid – Trenton McKinney Jul 28 '22 at 19:47
  • 1
    Thank you Trenton, it works, here is what I did, x_range=g.get_xlim(), g.set_xlim([x_range[0],x_range[1]*1.1]) – roudan Jul 29 '22 at 02:21

0 Answers0