library(ggplot2)
ggplot(iris, aes(x = Sepal.Length)) +
geom_histogram(binwidth = 0.3, fill = "skyblue", color = "black") +
facet_wrap(~ Species) + # creates a histogram for each species
labs(
title = "Distribution of Sepal Length by Species",
x = "Sepal Length",
y = "Count"
) +
theme_minimal()Program9
Program 9
Rpub Link : https://rpubs.com/PhEnOMeoN/pgm9
Create multiple histograms using ggplot2 to visualize how a variable is distributed across different groups in a built R dataset.