假設我有這兩個向量:
A <- c(0.06280179, 0.08216760, 0.07482619, 0.06823409, 0.06952835, 0.07018200, 0.06021379, 0.01093384, 0.01347112, 0.01426566, 0.02643976, 0.03703703, 0.04278447, 0.04821157, 0.05714920, 0.04756160, 0.02538775, 0.02267100, 0.02388572, 0.02309525, 0.0201453, 0.03132787, 0.03698205, 0.05634021, 0.06859215, 0.08044785, 0.08345671, 0.09029339, 0.08528164, 0.07538614, 0.01229222)
B <- c(0.06634636, 0.04257361, 0.04921238, 0.08225855, 0.11344899, 0.13373171, 0.14987047, 0.19256872, 0.14790440, 0.08028606, 0.06475687, 0.03736584, 0.05676217, 0.10489289, 0.17173170, 0.21296917, 0.27816564, 0.25458431, 0.29817322, 0.22127536, 0.15497217, 0.18341950, 0.14756396, 0.16856496, 0.13028875, 0.14073265, 0.11733407, 0.12458992, 0.12484860, 0.16910507, 0.28517631
我對調整對數函式和用灰色置信區間繪制數學運算式感興趣(就像我們可以用 做的那樣stat_smooth(aes(...), method = "lm"))。我怎樣才能做到這一點ggplot2?
提前致謝。
uj5u.com熱心網友回復:
更新:
library(tidyverse)
df <- tibble(A, B)
ggplot(df,aes(A, B))
geom_point()
stat_smooth(method="lm",formula=y~log(x),fill="grey")
theme_bw()

第一個答案:你的意思是這樣的:
library(tidyverse)
df <- tibble(A, B)
ggplot(df,aes(A, B))
stat_summary(fun.data=mean_cl_normal)
geom_smooth(method='lm', formula= y~x)

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/381232.html
上一篇:如何在R中使用帶有ggpie函式的回圈并在資料幀后保存檔案名?
下一篇:ggplot圖與觀察不一致
