statistic <- c(68,85,74,88,63,78,90,80,58,63)
math <- c(85,91,74,100,82,84,78,100,51,70)
colors <- c("#FDAE61",
"#D9EF8B")
plot(statistic,math,
pch = 19,
col = colors)

hist(math,
Statistic = TRUE,
main = "數學成績統計直方圖",
xlab = "數學成績")
## Warning in plot.window(xlim, ylim, log, ...): "Statistic" is not a graphical
## parameter
## Warning in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...):
## "Statistic" is not a graphical parameter
## Warning in axis(1, ...): "Statistic" is not a graphical parameter
## Warning in axis(2, at = yt, ...): "Statistic" is not a graphical parameter

categories <- c("公益活動", "科學創新", "體育競技", "知識閱讀","娛樂休閒")
counts <- c(25, 28, 36, 82, 185)
barplot(counts, names.arg=categories, main="大學生最喜歡參加的社團", col="lightblue", border="black")

pie(counts,
labels=categories,
main ="大學生最喜歡參加的社團",
col=c("red", "orange", "lightgreen", "lightyellow", "lightgray"))

plot(counts, type = "h", main="棒棒糖圖範例", lwd = 7, col = "darkblue", font.main = 4)
points(counts, pch=19, col="purple")

xlab = c("類別", side = 1, line = 2)
ylab = c("數值", side = 2, line = 2)
# 建立資料框 (Data Frame)
df <- data.frame(
Name = c("張青松", "王奕翔", "田新雨", "徐麗娜", "張志傑",
"趙穎睿", "王智強", "宋媛婷", "袁四方", "張建國"),
Statistic = c(68,85,74,88,63,78,90,80,58,63),
Math = c(85,91,74,100,82,84,78,100,51,70),
Japanese = c(84,63,61,49,89,51,59,53,79,91),
Management = c(89,76,80,71,78,60,72,73,91,85),
Accounting = c(86,66,69,66,80,60,66,70,85,82)
)
# 查看資料
df
## Name Statistic Math Japanese Management Accounting
## 1 張青松 68 85 84 89 86
## 2 王奕翔 85 91 63 76 66
## 3 田新雨 74 74 61 80 69
## 4 徐麗娜 88 100 49 71 66
## 5 張志傑 63 82 89 78 80
## 6 趙穎睿 78 84 51 60 60
## 7 王智強 90 78 59 72 66
## 8 宋媛婷 80 100 53 73 70
## 9 袁四方 58 51 79 91 85
## 10 張建國 63 70 91 85 82