Statistic <- c(68,85,74,88,63,78,90,80,58,65)
Math <- c(85,91,74,100,82,84,78,100,51,70)
plot(Statistic,Math)

hist(Statistic)

labels <- c("公益活動","科學創新","體育競技","知識閱讀","娛樂休閒")
Time <- c(25, 28, 36, 82, 185)
bp<- barplot(Time,
names.arg = labels,
main='大學生最喜歡參加的社團的次數分配表',
xlab='type',
ylab='Time',
ylim = c(0, 200))
text(bp, Time, labels = Time, pos = 3)

percent <- c(7, 8, 10, 23, 52)
labels <- c("公益活動","科學創新","體育競技","知識閱讀","娛樂休閒")
value = c(7,8,10,23,52)
pct <- round(percent / sum(percent) * 100, 1)
pie(
percent,
labels = paste(labels, pct, "%"),
main = "大學生最喜歡參加的社團的次數分配表",
col = c("skyblue", "lightgreen", "pink", "gold", "lightcoral"))

ylim_max <- max(Time) * 1.2
x_pos <- seq_along(Time)
labels <- c("公益活動","科學創新","體育競技","知識閱讀","娛樂休閒")
Time <- c(25, 28, 36, 82, 185)
x <- seq_along(Time)
plot(x, Time,
type = "n",
xaxt = "n",
xlab = "",
ylab = "",
ylim = c(0, 220),
yaxs = "i")
segments(x0 = x, y0 = 0, x1 = x, y1 = Time,
col = "lightskyblue", lwd = 2)
points(x, Time,
pch = 16,
col = "red",
cex = 1.4)
axis(1, at = x, labels = labels)
text(x, Time, labels = Time, pos = 3)
