# Cargar librerías necesarias
library(ggplot2)
library(readr)
library(dplyr)
##
## Adjuntando el paquete: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(scales)
##
## Adjuntando el paquete: 'scales'
## The following object is masked from 'package:readr':
##
## col_factor
# Leer el archivo
data <- read_table("Water_Area_TimeSeries_Procs.txt",
col_names = c("Year", "Month", "Day", "Area_ha"))
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## Year = col_double(),
## Month = col_character(),
## Day = col_character(),
## Area_ha = col_double()
## )
# Crear columna de fecha
data <- data %>%
mutate(Date = as.Date(paste(Year, Month, Day, sep = "-")))
# Graficar como barras con formato científico
ggplot(data, aes(x = Date, y = Area_ha)) +
geom_bar(stat = "identity", fill = "steelblue") +
scale_y_continuous(labels = scientific_format(digits = 3)) +
labs(
title = "Evolución temporal del área cubierta por agua",
x = "Fecha",
y = expression("Área (ha)")
) +
theme_minimal(base_size = 14)
