R 教材:PHP |
data(cars) plot(cars, main = "lowess(cars)") lines(lowess(cars), col = 2) lines(lowess(cars, f=.2), col = 3) legend(5, 120, c(paste("f = ", c("2/3", ".2"))), lty = 1, col = 2:3) |
# a 2-dimensional example library(mva) x <- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2)) cl <- kmeans(x, 2, 20) plot(x, col = cl$cluster) points(cl$centers, col = 1:2, pch = 8) |
library(mva) data(USArrests) hc <- hclust(dist(USArrests), "ave") plot(hc) plot(hc, hang = -1) |
library(survival) data(aml) leukemia.surv <- survfit(Surv(time, status) ~ x, data = aml) plot(leukemia.surv,lty=1:2,legend.pos=0,col=c("Red","Blue"), legend.text=c("Maintenance", "No Maintenance")) |
data(iris) pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species", pch = 21, bg = c("red", "green3", "blue")[codes(iris$Species)]) |
陳韋辰 (04/08/19) --- |