mEng <- c(80,78,63,55,97,43,86,69)
fEng <- c(96,94,99,92,97,86,82,89)
mJp <- c(84,77,95,45,87,57,77,79)
fJp <- c(92,90,93,97,95,90,91,83)
myEng <- c(90)
myJp <- c(85)
colors <- c("green")
plot(mEng, mJp,
pch = 15,
col = colors,
main ="Language Score",
xlab ="English",
ylab ="Japanese")
points(mean(mEng), mean(mJp), pch = 4, col ="lightyellow", cex = 2)
points(fEng, fJp, pch = 15, col = "orange", cex = 1)
points(myEng, myJp, pch = 15, col = "red", cex = 2)
legend("bottomright",
pch = 15,
col = c("green", "orange", "red", "lightyellow"),
legend = c("Male", "Female", "My Grade", "Male mean")
)

hist(fEng,
main ="Histogram of English scores",
xlab ="Female English scores",
ylab ="Frequency",
col ="purple")

x<- c(1,2,2,3)
labels <- c("80-85","85-90","90-95","95-100")
pie(x,labels,main ="女生英文成績分布", col=rainbow(length(x)),edges=10)

# Load ggplot2
library(ggplot2)
# Load ggplot2
library(ggplot2)
# Create data
data <- data.frame(
name=c("王曉明","B","C","D","E","F") ,
value=c(50,55,63,55,67,43)
)
# Barplot
ggplot(data, aes(x=name, y=value)) +
geom_bar(stat = "identity", width=0.2, fill="skyblue")
