R 程式設計/圖形語法
外觀
< R 程式設計
| 本節是存根。 您可以透過 擴充套件它 來幫助 Wikibooks。 |
Hadley Wickham 開發了 **ggplot2**,一個根據 *圖形語法* 原則設計的圖形庫。
我們使用 qplot() 以及選項 stat=function
# Plot the quadratic function
square <- function(x){
x^2
}
mode(square)
qplot(c(0, 2), stat = "function", fun = square, geom = "line")
以下是使用正弦函式的另一個示例
# plot the sinus functon
qplot(c(-10, 10), stat = "function", fun = sin, geom = "line")
- 萊蘭·威爾金森,圖形語法(統計與計算),施普林格出版社,2005
- 哈德利·威克漢姆,ggplot2:資料分析的優雅圖形,用R!,施普林格出版社,2009
