# Install and load necessary packages
install.packages("ggplot2")
library(ggplot2)
# Create dummy data for the first plot
set.seed(123)
data1 <- data.frame(
x = rnorm(100),
y = rnorm(100)
)
# Create the first plot
plot1 <- ggplot(data1, aes(x = x, y = y)) +
geom_point(color = "blue") +
ggtitle("Scatter Plot")
# Create dummy data for the second plot
data2 <- data.frame(
category = rep(c("A", "B", "C"), each = 50),
value = rnorm(150)
)
# Create the second plot
plot2 <- ggplot(data2, aes(x = category, y = value, fill = category)) +
geom_boxplot() +
ggtitle("Boxplot by Category")
# Display both plots together
library(gridExtra)
grid.arrange(plot1, plot2, ncol = 2)