Gráfico de Barras
# Carregar pacotes
library(ggplot2)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
dados <- data.frame(
Animal = c("Escorpião", "Serpente", "Aranha", "Outros animais"),
Total = c(8208, 4944, 4661, 5834),
Porcentagem = c(34.71, 20.91, 19.71, 24.67)
)
# Gráfico de barras
ggplot(dados, aes(x = Animal, y = Total, fill = Animal)) +
geom_bar(stat = "identity") +
labs(title = "Casos de Intoxicação por Animal Peçonhento no Brasil (2005)",
x = "Animal",
y = "Número de Casos") +
theme_minimal() +
scale_fill_brewer(palette = "Set1")

Gráfico de pizza
plot_ly(dados, labels = ~Animal, values = ~Porcentagem, type = 'pie') %>%
layout(title = "Proporção de Casos de Intoxicação por Animal Peçonhento no Brasil (2005)")