library(ggplot2)
library(data.table)
datairis <- data.table(iris)
datairis
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## <num> <num> <num> <num> <fctr>
## 1: 5.1 3.5 1.4 0.2 setosa
## 2: 4.9 3.0 1.4 0.2 setosa
## 3: 4.7 3.2 1.3 0.2 setosa
## 4: 4.6 3.1 1.5 0.2 setosa
## 5: 5.0 3.6 1.4 0.2 setosa
## ---
## 146: 6.7 3.0 5.2 2.3 virginica
## 147: 6.3 2.5 5.0 1.9 virginica
## 148: 6.5 3.0 5.2 2.0 virginica
## 149: 6.2 3.4 5.4 2.3 virginica
## 150: 5.9 3.0 5.1 1.8 virginica
ggplot(iris, aes(x = Sepal.Length)) +
geom_histogram(binwidth = 0.5, fill = "pink", color = "black") +
labs(title = "Histogram Sepal Length")

ggplot(iris, aes(y = Sepal.Length)) +
geom_boxplot(fill = "grey") +
labs(title = "Boxplot Sepal Length")

ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
geom_point(aes(color = Species)) +
labs(title = "Scatter Plot Sepal Length vs Sepal Width")

ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) +
geom_boxplot() +
labs(title = "Boxplot Sepal Length berdasarkan Species")

pairs(iris[,1:4], col = iris$Species, pch = 19)

ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, size = Petal.Length, color = Species)) +
geom_point(alpha = 0.7) +
labs(title = "Bubble Plot Sepal vs. Petal")
