2
使用df
及以下GGPLOT2:添加回歸方程和R2和情節
代碼調整自己的位置,我得到這個情節
感謝@ kdauria的回答this question,我添加了迴歸方程和R2,如下圖所示
source_gist("524eade46135f6348140")
ggplot(df, aes(x= new_price, y= carat, color = cut))+
stat_smooth_func(geom="text",method="lm",hjust=0,parse=TRUE)+
geom_point(alpha = 0.3)+
facet_wrap(~clarity, scales = "free_y")+
geom_smooth(method = "lm", se = F)
現在,我要調整的迴歸方程和R2的位置,以便在每個所述小面(例如一個特定的地方在每個小面的右下方的「例如0.2y和0.8x)。
我試圖通過vjust
和hjust
調整位置,但它沒有奏效。
任何建議將不勝感激。
有沒有辦法添加p值? – aelwan
請檢查這個問題http://stackoverflow.com/questions/37536950/ggplot2-add-p-values-to-the-plot – aelwan
請參閱[答案](http://stackoverflow.com/a/ 35140066/3817004)以[ggplot2:在圖表中添加回歸直線方程和R2](http://stackoverflow.com/q/7549694/3817004)獲取更多詳細信息,或者聯繫作者。 – Uwe