OptirrigVIEW is a lightweight R package meant to gather visualization functions used across the Optirrig ecosystem.
It provides tools to prepare, inspect, and visualize outputs from Optirrig workflows, as well as generic tabular data. The package focuses on consistent graphics for irrigation-oriented analyses: scenario comparison, crop development, soil water balance indicators, biomass, yield, and other variables commonly produced by OptirrigCORE studies.
ggplot2 graphics for time series, indicators, and scenario
comparisonsplotly
Then you can install the development version of OptirrigVIEW like so:
install.packages('OptirrigVIEW', repos = c('https://inrae.r-universe.dev', 'https://cloud.r-project.org'))
library(OptirrigVIEW)
The basic workflow is to normalize tabular data with view_data(), then
draw it with view_plot() or the package plot() methods.
library(OptirrigVIEW)
results <- data.frame(
Date = as.Date("2024-06-01") + 0:4,
LAI = c(0.3, 0.8, 1.6, 2.1, 2.4),
Biomass = c(0.1, 0.4, 0.9, 1.7, 2.6),
RU = c(120, 105, 92, 78, 70)
)
view_tbl <- view_data(
results,
x_var = "Date",
value_vars = c("LAI", "Biomass", "RU")
)
view_plot(
view_tbl,
geom = "line",
title = "Optirrig indicators"
)
You can also compose several panels from the same normalized table.
dashboard <- plot(
view_tbl,
options = list(
title = "OptirrigVIEW dashboard",
plots = list(
lai = plot_vars("Date", "^LAI$", options = list(title = "LAI")),
biomass = plot_vars("Date", "^Biomass$", options = list(title = "Biomass")),
reserve = plot_vars("Date", "^RU$", options = list(title = "Soil water reserve"))
),
layout = "lai | biomass / reserve"
)
)
dashboard
For interactive rendering, use interactive = TRUE on a single plot or
pass an existing ggplot to view_plotly().
interactive_lai <- view_plot(
results,
x_var = "Date",
y_var = "LAI",
title = "Interactive LAI",
interactive = TRUE
)
view_data() accepts data frames, matrices, named lists of tables, and
nested Optirrig-like lists containing tabular outputs in entries such as
outputs, data, values, result, table, or matrix.
Package sources and documentation assets are available at:
https://forge.inrae.fr/OptirrigHIVE/OptirrigVIEW
The development of the OptirrigVIEW package is carried out by the OPTIMISTE team of the UMR G-EAU research unit, specialized in water management, uses, and stakeholders (Montpellier, INRAE).