Exercício 1.1

ggplot(data = mtcars, aes(x = wt, y = mpg, color = factor(cyl))) +
geom_point(size = 3) +
labs(
title = "Relação entre Peso e Consumo de Combustível",
x = "Peso do Veículo (wt)",
y = "Consumo (mpg)",
color = "Cilindros"
) +
theme_minimal()

Exercício 1.2

ggplot(diamonds, aes(x = fct_infreq(cut), fill = cut)) +
  geom_bar() +
  geom_text(stat = "count", aes(label = after_stat(count)), vjust = -0.5) +
  scale_fill_brewer(palette = "Spectral") +
labs(
    title = "Contagem de Diamantes por Tipo de Corte",
    x = "Corte (Ordenado por Frequência)",
    y = "Contagem",
    fill = "Corte"
  ) +
  theme_minimal()

Exercício 1.3

Criando o boxplot personalizado

ggplot(diamonds, aes(x = cut, y = price, fill = cut)) +
  geom_boxplot() +
  labs(title = "Distribuição de Preços por Corte de Diamante",
       x = "Corte",
       y = "Preço") +
  scale_fill_manual(values = c("Fair" = "#FF9999", 
                               "Good" = "#99FF99", 
                               "Very Good" = "#9999FF", 
                               "Premium" = "#FFFF99", 
                               "Ideal" = "#FF99FF")) +
  theme_minimal() +
  theme(legend.position = "none",  
        axis.text.x = element_text(angle = 0, hjust = 0.5))