0

I was trying to plot this using displot.

This is my plot

my code

plt = sns.displot(reg_pred-y_test,kind = 'kde')

Now I want to set ranges of X axis (-20,20) and Y axis (0.00 to 0.12).

I tried plt.xlim(-20,20) It gives me the followring error message :

AttributeError: 'FacetGrid' object has no attribute 'xlim'

Can anyone help me with setting the ranges?

dijsat
  • 3
  • 4
  • See https://stackoverflow.com/q/25212986/7758804 – Trenton McKinney Feb 08 '23 at 18:06
  • Please don't assign `plt = ...` as it overwrites `plt` from `import matplotlib.pyplot as plt`, and causes the error you see. As `displot` is a figure-level function, returning a `FacetGrid`, the custom name for the return value in seaborn examples is `g = sns.displot(...)`. Then, you can use `g.set(xlim=(-20, 20))` – JohanC Feb 08 '23 at 19:27

0 Answers0