Legenda da Imagem
Legenda da Imagem

install.packages(“ggplot2”)

library(ggplot2)

´´´{r} ggplot(diamonds, aes(x = price))+ geom_histogram(bins = 30, fill = “steelblue”, color = “black”)+ labs(title = “Distribuição de Preços dos Diamantes”, x = “Preço (USD)”, y = “Frequência”)+ theme_minimal() ´´´

´´´{r} mtcars\(cyl <- as.factor(mtcars\)cyl) ggplot(data = mtcars, aes(x = wt, y = mpg)) +
geom_point(aes(color = cyl)) +
labs(
title = “Relação entre Peso e Consumo de Combustível”, x = “Peso do Carro (lb/1000)”,
y = “Milhas por Galão (MPG)”,
color = “Cilindros”
) + theme_minimal()
´´´

library(ggplot2) install.packages(“dplyr”) library(dplyr) install.packages(“forcats”) library(forcats)

´´´{r} data_contagem <- diamonds %>% count(cut) %>% mutate(cut = fct_reorder(cut, n, .desc = TRUE)) ggplot(data = data_contagem, aes(x = cut, y = n, fill = cut)) + geom_col() + geom_text(aes(label = n), vjust = -0.5, color = “black”, size = 4) + scale_fill_brewer(palette = “RdBu”) + labs( title = “Contagem de Diamantes por Qualidade de Corte”, x = “Qualidade do Corte”, y = “Número de Diamantes”, fill = “Corte” ) + theme_minimal() + scale_y_continuous(expand = expansion(mult = c(0, 0.1))) ´´´ ´´´{r}
cores_customizadas <- c( “Fair” = “#FF6961”,
“Good” = “#FFB482”,
“Very Good” = “#F3FF69”, “Premium” = “#77DD77”,
“Ideal” = “#69A8FF”
) ggplot(data = diamonds, aes(x = cut, y = price, fill = cut)) + geom_boxplot() + scale_fill_manual(values = cores_customizadas) + labs( title = “Distribuição de Preços de Diamantes por Qualidade de Corte”, subtitle = “Dataset: diamonds”, x = “Qualidade do Corte”, y = “Preço (USD)” ) + theme_minimal()+ theme( legend.position = “none”, axis.text.x = element_text(angle = 45, hjust = 1) ) ´´´

library(htmltools)

´´´{r} ggplot(data = htmltools) logo <- tags$img(src = “C:\Users\PMMG\Downloads”, alt = “Logomarca”, style = “max-width: 100px; max-height: 100px;”) html_print(logo) ´´´