# scatter plot
plot(mtcars$hp, mtcars$mpg,
pch = 19, # solid dots
cex = 1.5, # dot size
col = "pink", # dot color
main = "Horsepower vs Miles Per Gallon",
xlab = "Horsepower",
ylab = "Miles Per Gallon")
# Add continuous regression line
model <- lm(mpg ~ hp, data = mtcars)
abline(model, col = "blue", lwd = 2)
# Boxplot
boxplot(mpg ~ cyl,
data = mtcars,
col = "purple",
main = "MPG by Number of Cylinders",
xlab = "Cylinders",
ylab = "Miles Per Gallon")