library(ggplot2)Warning: package 'ggplot2' was built under R version 4.5.3
Write an R program to create multiple dot plots for grouped data, comparing the distributions of variables across different categories, using ggplot2 lib
library(ggplot2)Warning: package 'ggplot2' was built under R version 4.5.3
data <- data.frame(
Category = rep(c("A", "B", "C"), each = 6),
Group = rep(c("G1", "G2"), each = 3, times = 3),
Value = c(5, 6, 7, 8, 9, 10,
4, 5, 6, 7, 8, 9,
6, 7, 8, 9, 10, 11)
)ggplot(data, aes(x = Category, y = Value, color = Group)) +
geom_point(position = position_dodge(width = 0.6), size = 3) +
facet_wrap(~ Group) +
labs(
title = "Multiple Dot Plots for Grouped Data",
x = "Category",
y = "Values",
color = "Group"
) +
theme_minimal()