Students Dataset
students <- data.frame(
Name = c("Ali", "Maryan", "Ahmed", "Khadra", "Layla", "Hassan"),
Gender = c("M", "F", "M", "F", "F", "M"),
Score = c(80, 90, 70, 85, 88, 75),
Age = c(20, 21, 22, 21, 20, 22)
)
Before we creating the diffferent charts, we will loading
GGPLOT2
library(ggplot2)
Firstly, Barchart
ggplot(students, aes(x = Gender)) +
geom_bar(fill = "steelblue") +
labs(title = "Number of Students by Gender",
x = "Gender", y = "Count")

Thirdly, Scatterplot
ggplot(students, aes(x = Age, y = Score, color = Gender)) +
geom_point(size = 3) +
labs(title = "Age vs Score", x = "Age", y = "Score")
