install.packages(“ggplot2”)

if (!require("ggplot2")) install.packages("ggplot2")
## Loading required package: ggplot2
library(ggplot2)

datos_foz <- data.frame(
  Direccion = factor(c("N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", 
                       "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"),
                     levels = c("N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", 
                                "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW")),
  Frecuencia = c(8, 5, 12, 7, 4, 3, 5, 6, 10, 15, 18, 12, 14, 10, 9, 6),
  Velocidad = c(12, 15, 18, 14, 10, 9, 11, 13, 20, 22, 25, 24, 22, 19, 16, 14)
)

ggplot(datos_foz, aes(x = Direccion, y = Frecuencia, fill = Velocidad)) +
  geom_bar(stat = "identity", width = 1, color = "white") +
  coord_polar(start = -pi/16) + 
  scale_fill_gradient(low = "skyblue", high = "darkred") +
  theme_minimal() +
  labs(title = "Rosa de los Vientos - Foz", x = NULL, y = "Frecuencia")