# Sample data
set.seed(42) # For reproducibility
data <- rnorm(100)
# Create a new graphics device (optional, useful for saving plots)
# pdf("visual_representations.pdf", width = 8, height = 8)
# Create and display a scatter plot
plot(data, main = "Scatter Plot", xlab = "X-axis", ylab = "Y-axis", col = "blue")
# Create and display a histogram
hist(data, main = "Histogram", xlab = "Value", col = "lightblue", breaks = 20)
# Create and display a line chart
x <- 1:100
y <- cumsum(rnorm(100))
plot(x, y, type = "l", main = "Line Chart", xlab = "X-axis", ylab = "Y-axis", col = "green")
# Create and display a pie chart
slices <- c(10, 15, 25, 50)
lbls <- c("A", "B", "C", "D")
pie(slices, labels = lbls, main = "Pie Chart", col = rainbow(length(slices)))
# Create and display a box plot
boxplot(data, main = "Box Plot", xlab = "Value", col = "purple")
# Create and display a scatter plot
x <- rnorm(50)
y <- x + rnorm(50, sd = 0.2)
plot(x, y, main = "Scatter Plot", xlab = "X-axis", ylab = "Y-axis", col = "red")
# Close the graphics device (if opened)
# dev.off()