Skip to content

Commit

Permalink
elimino comentariosinnecesarios
Browse files Browse the repository at this point in the history
  • Loading branch information
Julenasti committed May 30, 2024
1 parent 9ac8f94 commit 746a7a5
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions scripts_texto_nota.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,14 @@ par(mar = c(5, 4, 4, 8), xpd = TRUE)

plot(aggregated_data$year, aggregated_data$body_mass_g, type = "n", xlab = "year", ylab = "mean body mass (g)", xaxt = "n")

# Separar los datos por especie
species_data_list <- split(aggregated_data, aggregated_data$species)

# Función para dibujar líneas
plot_species_line <- function(data, color) {
lines(data$year, data$body_mass_g, col = color, type = "o")
}

species_colors <- c("Adelie" = "red", "Chinstrap" = "green", "Gentoo" = "blue")

# Aplicar la función a cada elemento de la lista utilizando lapply
lapply(names(species_data_list), function(species) {
plot_species_line(species_data_list[[species]], species_colors[[species]])
})
Expand All @@ -169,5 +166,3 @@ axis(1, at = c(2007, 2008, 2009))
legend("topright", inset = c(-0.3, 0.3),
legend = names(species_colors), col = species_colors, lty = 1, title = "Species")



0 comments on commit 746a7a5

Please sign in to comment.