library(ggplot2)
data(mtcars)
mtcars$cyl <- as.factor(mtcars$cyl)
ggplot(data = mtcars) +
aes(x = wt, y = mpg, color = cyl) +
geom_point(size = 3) +
labs(
title = "Relação entre Peso e Consumo de Combustível",
x = "Peso do Carro (milhares de libras)",
y = "Milhas por Galão (MPG)",
color = "Cilindros (cyl)"
) +
theme_minimal() +
theme(
plot.title = element_text(hjust = 0.5, face = "bold"),
legend.position = "bottom"
)