I have a data frame data, I would like draw a proper density plot for it.When I have drown plot the interval is shown a wider range than my data.
input:
X Y
1 0.4078791 0.471845
2 0.2892282 0.205871
3 0.4254774 0.407548
4 0.4749196 0.396765
5 0.2763627 0.142572
6 0.3942402 0.457668
7 0.2427948 0.248003
8 0.3117754 0.322484
9 0.4350599 0.450679
10 0.4459200 0.338858
That's how a kernel density estimation works. The result must cover a wider range than your data. You can try different kernels and bandwidth algorithms or fiddle with the adjust
parameter, but you actually want the density estimate to cover a wider range than your data. Otherwise it wouldn't be a proper density estimate.