Questão 1
intoxicacoes <- tibble(
animal = c("Escorpião", "Serpente", "Aranha", "Outros animais"),
total = c(8208, 4944, 4661, 5834),
porcentagem = c(34.71, 20.91, 19.71, 24.67)
)
cores_animais <- c(
"Escorpião" = "#E4572E",
"Serpente" = "#76B041",
"Aranha" = "#4D9DE0",
"Outros animais" = "#F2B134"
)
titulo_grafico <- "Casos de intoxicação por animal peçonhemto Brasil (2005)"
Gráfico de barras
ggplot(intoxicacoes, aes(x = reorder(animal, -total), y = total, fill = animal)) +
geom_col(width = 0.7) +
geom_text(aes(label = format(total, big.mark = ".")), vjust = -0.5) +
scale_fill_manual(values = cores_animais, name = "Animal") +
scale_y_continuous(labels = label_number(big.mark = "."),
expand = expansion(mult = c(0, 0.1))) +
labs(title = titulo_grafico, x = "Animal peçonhento", y = "Número de casos") +
theme_minimal(base_size = 13) +
theme(plot.title = element_text(face = "bold", hjust = 0.5))
## Warning in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, :
## 'big.mark' and 'decimal.mark' are both '.', which could be confusing
## Warning in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, :
## 'big.mark' and 'decimal.mark' are both '.', which could be confusing

Gráfico de pizza
ggplot(intoxicacoes, aes(x = "", y = porcentagem, fill = animal)) +
geom_col(width = 1, color = "white") +
geom_text(aes(label = paste0(format(porcentagem, decimal.mark = ","), "%")),
position = position_stack(vjust = 0.5), color = "white", fontface = "bold") +
coord_polar(theta = "y") +
scale_fill_manual(values = cores_animais, name = "Animal") +
labs(title = titulo_grafico) +
theme_void(base_size = 13) +
theme(plot.title = element_text(face = "bold", hjust = 0.5))
