Skip to content

Instantly share code, notes, and snippets.

@juanchiem
Last active April 10, 2022 13:41
Show Gist options
  • Save juanchiem/2de3d707cd99f38fad88b39a05472769 to your computer and use it in GitHub Desktop.
Save juanchiem/2de3d707cd99f38fad88b39a05472769 to your computer and use it in GitHub Desktop.
dat <- tibble::tribble(
~date, ~ndvi,
"2020-05-18", 0.7655,
"2020-06-14", 0.723,
"2020-07-12", 0.6178,
"2020-08-21", 0.437,
"2020-09-07", 0.4763,
"2020-09-10", 0.4928,
"2020-09-12", 0.4831,
"2020-09-22", 0.4774,
"2020-10-02", 0.5794,
"2020-10-07", 0.606
) %>%
mutate(date = lubridate::ymd(date),
days = difftime(date, min(date), units="days"))
dat %>%
ggplot(aes(date, ndvi)) +
geom_line() +
scale_x_date(breaks = dat$date,
name = "",
sec.axis = dup_axis(breaks=dat$date,
labels = as.character(round(dat$days)),
name = "Días desde aplicación"))
@juanchiem
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment