sns.regplot set limit on regression line y axis

1.4k Views Asked by At

For the given seaborn plot, how do we set the regression line y-axis limit within 5.
The rating never crosses 5. Is there a way to truncate/clip it? sns.regplot(x="Reviews", y="Rating", data=df);


enter image description here


2

There are 2 best solutions below

0
On BEST ANSWER
g = sns.regplot(x="Reviews", y="Rating", data=df);
g.set(ylim=(None, 5))
plt.title('Rating VS Reviews')

enter image description here

0
On
sns.regplot(x="Reviews", y="Rating", data=df)
sns.plt.ylim(0, y_lim)

Change the value of y_lim according to your requirements