library(ggplot2)
data(mtcars)
# Create a scatter plot of Miles Per Gallon (mpg) vs Horsepower (hp)
ggplot(mtcars, aes(x = hp, y = mpg)) +
geom_point(aes(color = factor(cyl), shape = factor(gear)), size = 3) +
labs(
title = "MPG vs Horsepower in mtcars Dataset",
subtitle = "Colored by Cylinder and Shaped by Gear",
x = "Horsepower (hp)",
y = "Miles Per Gallon (mpg)",
caption = "Data Source: mtcars dataset"
) +
theme_minimal()

# Save the plot
ggsave("mtcars_visualization.png")
## Saving 7 x 5 in image