Adding an offset to stat_smooth

后端 未结 1 1471
温柔的废话
温柔的废话 2021-01-27 03:58

I\'m working with a dataset where I have to transform some data for a curve fit. I\'m plotting it using ggplot2, and can use stat_smooth on the transformed data to get the fit,

1条回答
  •  长发绾君心
    2021-01-27 04:29

    Sometimes things can be very obvious :

    qplot(1:10, 1:10)+stat_smooth(formula=(y+1)-1~x, method="lm")
    

    If you can raise it 1 by adding 1 to y, you can lower it 1 by substracting 1 from y. ;-)

    0 讨论(0)
提交回复
热议问题