ggplot瑣碎筆記

2021-07-02 11:48:17 字數 1324 閱讀 5537

set

.seed(1410)

dsmall

span引數0到1, 很不平滑到很平滑

qplot(carat, price , data = dsmall, geom =c('point','smooth'), span = 0.2)
loess對於大資料並不十分適用(o(

n)), 因此, 當n超過1000時將預設採用另一種平滑演算法.

library(mgcv)

qplot(carat, price, data = dsmall, geom = c("point", "smooth"), method = "gam",

formula = y ~ s(x))

qplot(carat, price, data = dsmall, geom = c("point", "smooth"), method = "gam",

formula = y ~ s(x, bs = "cs"))

公式formula = y ~ s(x, bs = 「cs」))是資料量超過1000的預設選項.

在運用線性模型作為平滑器時 formula 引數的作用。左圖是 formula =

## y ~ x 的預設值, 右圖是 formula = y ~ ns(x, 5)。

library

(splines)

qplot

(carat, price, data = dsmall, geom = c("point", "smooth"), method = "lm")

qplot

(carat, price, data = dsmall, geom = c("point", "smooth"), method = "lm",

formula = y ~ ns(x, 5))

對異常值不敏感

ThinkJs筆記瑣碎

記錄一些瑣碎的在使用thinkjs遇到的問題 thinkjs預設production環境關閉對www下資源的相對路徑的訪問,官方建議通過nginx轉向的位址的絕對路徑訪問,想要在production環境訪問相對路徑的話需要到src config middleware.js裡關閉對靜態資源的限制。路徑...

jQuery瑣碎筆記

1 jquery中可以實現 set和 get功能的方法 2 擴充套件 jq的功能 例項 extend max function a,b 為 jquery 擴充套件了min,max 兩個方法 alert a 10,b 20,max max 10,20 min min 10,20 這樣呼叫該方法 這裡涉...

ggplot2學習筆記(一)

該部分筆記整理於這裡 對比如下量 與繪圖結果 其區別在於前者在指定geom smooth中的aes加入了語句color cut。即在未指定分組要素時,預設按整體資料做平滑。question 想要改變圖表標題及x y軸標題如下 ggplot diamonds,aes x carat,y price,c...