title: “Tarea” author: “Axel Antunez” cuenta: “20231030909” date: “2024-07-10” output: html_document
install.packages(“ggplot2”) library(ggplot2) data(tree) # Filtro para seleccionar árboles con altura entre 70 y 80 pies y diámetro menor a 13 pulgadas filtro <- trees\(height >= 70 & trees\)height <= 80 & trees$Girth < 13
Arboles <- trees[filtro, ]
print(Arboles)library(ggplot2)
set.seed(123) arboles_cherry <- data.frame( diametro_pulgadas = runif(50, 5, 15), altura_pies = runif(50, 10, 30) ) filtro <- arboles_cherry$diametro_pulgadas > 10
ggplot(arboles_cherry, aes(x = diametro_pulgadas, y = altura_pies)) + geom_point(aes(color = filtro), shape = 15, size = 4) + scale_color_manual(values = c(“black”, “green”), labels = c(“No cumple”, “Cumple”)) + labs( title = “Altura y Ancho de Árboles Cherry Negros”, x = “Diámetro (pulgadas)”, y = “Altura (pies)”, color = “Filtro” ) + theme_minimal() + theme( legend.position = “bottom” )