rbokeh包
带拟合线的散点图
z <- lm(dist~speed,data = cars)
p <- figure(width = 600,height = 600) %>%
ly_points(cars,hover = cars) %>%
ly_lines(lowess(cars),legend = "lowess") %>%
ly_abline(z,type = 2,legend = "lm")
lowess是由一个复杂的算法定义的,原始算法的Ratfor (W. S. Cleveland)可以在R源文件“src/appl/lowess.doc”中找到。通常使用局部线性多项式拟合,但在某些情况下(请参阅文件)可以使用局部常数拟合。“局部”是由距离最近的楼层(f*n)的距离来定义的,对于落在附近的x使用三次加权。
figure(width = 600,height = 600) %>%
ly_hist(eruptions,data = faithful,breaks = 40,freq = FALSE) %>%
ly_density(eruptions,data=faithful)
figure(ylab = "Height(inches)",width = 600) %>%
ly_boxplot(voice.part,height,data = lattice::singer)