data("VADeaths")
cores_idades <- c("#2F80ED", "#27AE60", "#F2C94C", "#EB5757", "#9B51E0")
par(mar = c(7, 5, 4, 8))
barplot(
height = VADeaths,
beside = TRUE,
col = cores_idades,
main = "Taxas de mortalidade na Virgínia em 1940",
xlab = "Grupo demográfico",
ylab = "Taxa de mortalidade por 1000 habitantes",
ylim = c(0, 100),
las = 2
)
legend(
"topright",
inset = c(-0.25, 0),
legend = rownames(VADeaths),
fill = cores_idades,
title = "Faixa etária",
bty = "n",
xpd = TRUE
)