![]() |
|
---|---|
Próximo Cumpleaños | 75 días |
Más Información | library(ggplot2) library(dplyr) verde_mente <- "#C44E52" gris_claro <- "#CCCCCC" gris_oscuro <- "#4D4D4D" azul_apa <- "#4C72B0" rojo_apa <- "#A8D5BA" set.seed(123) df <- data.frame( categoria = sample(c("Mango", "Frutilla", "Granada"), 100, replace = TRUE), puntaje = rnorm(100, mean = 500, sd = 80), genero = sample(c("Femenino", "Masculino"), 100, replace = TRUE), experiencia = round(runif(100, 0, 40), 1) ) ggplot(df, aes(x = categoria)) + geom_bar(fill = verde_mente) + theme_minimal() + labs( title = "Frecuencia por gusto de fruta", x = "Tipos de fruta", y = "Frecuencia" ) + theme( plot.title = element_text(size = 12), axis.title = element_text(size = 10) ) ggplot(df, aes(x = puntaje)) + geom_histogram(binwidth = 20, fill = verde_mente, color = "black") + theme_minimal() + labs( title = "Distribución de puntajes", x = "Puntaje", y = "Frecuencia" ) + theme( plot.title = element_text(size = 12), axis.title = element_text(size = 10) ) ggplot(df, aes(x = categoria, y = puntaje)) + geom_boxplot(fill = verde_mente) + theme_minimal() + labs( title = "Distribución de puntajes por tipo de establecimiento", x = "Tipo de escuela", y = "Puntaje" ) + theme( plot.title = element_text(size = 12), axis.title = element_text(size = 10) ) ggplot(df, aes(x = puntaje)) + geom_density(fill = verde_mente, alpha = 0.7) + theme_minimal() + labs( title = "Densidad de puntajes", x = "Puntaje", y = "Densidad" ) + theme( plot.title = element_text(size = 12), axis.title = element_text(size = 10) ) ggplot(df, aes(x = experiencia, y = puntaje)) + geom_point(color = azul_apa, alpha = 0.6, size = 2) + geom_smooth(method = "lm", color = rojo_apa, se = FALSE) + theme_minimal() + labs( title = "Relación entre experiencia y puntaje", x = "Años de experiencia", y = "Puntaje" ) + theme( plot.title = element_text(size = 12), axis.title = element_text(size = 10) ) ggplot(df, aes(x = puntaje)) + geom_histogram(binwidth = 20, fill = verde_mente, color = "black") + facet_wrap(~ genero) + theme_minimal() + labs( title = "Distribución de puntajes por género", x = "Puntaje", y = "Frecuencia" ) + theme( plot.title = element_text(size = 12, face = "bold"), strip.text = element_text(face = "bold"), axis.title = element_text(size = 10) ) ggplot(df, aes(x = categoria, fill = genero)) + geom_bar(position = "fill") + scale_y_continuous(labels = scales::percent_format()) + scale_fill_manual(values = c("Femenino" = verde_mente, "Masculino" = gris_claro)) + theme_minimal() + labs( title = "Proporción de género por tipo de colegio", x = "Tipo de escuela", y = "Proporción", fill = "Género" ) + theme( plot.title = element_text(size = 12, face = "bold"), axis.title = element_text(size = 10) ) ggplot(df, aes(x = puntaje)) + geom_histogram(binwidth = 20, fill = verde_mente, color = "black") + facet_wrap(~ genero) + theme_minimal() + labs( title = "Distribución de puntajes por género", x = "Puntaje", y = "Frecuencia" ) + theme( plot.title = element_text(size = 12, face = "bold"), strip.text = element_text(face = "bold"), axis.title = element_text(size = 10) ) |