plot_hydroMet {hydroToolkit} | R Documentation |
Methods to easily use ggplot2
or plotly
(interactive)
Description
This method allows you to make plots (using simple and expressive arguments) of the variables contained inside an hydroMet_XXX
object. The plot outputs can be static (ggplot2
) or interactive (plotly
).
Usage
plot_hydroMet(
obj,
slot_name,
col_number,
interactive = FALSE,
line_type = NULL,
line_color = "dodgerblue",
x_lab = "Date",
y_lab = "y",
title_lab = NULL,
legend_lab = NULL,
double_yaxis = NULL,
list_extra = NULL,
from = NULL,
to = NULL,
scatter = NULL
)
## S4 method for signature 'hydroMet_BDHI'
plot_hydroMet(
obj,
slot_name,
col_number,
interactive = FALSE,
line_type = NULL,
line_color = "dodgerblue",
x_lab = "Date",
y_lab = "y",
title_lab = NULL,
legend_lab = NULL,
double_yaxis = NULL,
list_extra = NULL,
from = NULL,
to = NULL
)
## S4 method for signature 'hydroMet_CR2'
plot_hydroMet(
obj,
slot_name,
col_number,
interactive = FALSE,
line_type = NULL,
line_color = "dodgerblue",
x_lab = "Date",
y_lab = "y",
title_lab = NULL,
legend_lab = NULL,
double_yaxis = NULL,
list_extra = NULL,
from = NULL,
to = NULL
)
## S4 method for signature 'hydroMet_DGI'
plot_hydroMet(
obj,
slot_name,
col_number,
interactive = FALSE,
line_type = NULL,
line_color = "dodgerblue",
x_lab = "Date",
y_lab = "y",
title_lab = NULL,
legend_lab = NULL,
double_yaxis = NULL,
list_extra = NULL,
from = NULL,
to = NULL
)
## S4 method for signature 'hydroMet_IANIGLA'
plot_hydroMet(
obj,
slot_name,
col_number,
interactive = FALSE,
line_type = NULL,
line_color = "dodgerblue",
x_lab = "Date",
y_lab = "y",
title_lab = NULL,
legend_lab = NULL,
double_yaxis = NULL,
list_extra = NULL,
from = NULL,
to = NULL
)
## S4 method for signature 'hydroMet_compact'
plot_hydroMet(
obj,
slot_name,
col_number,
interactive = FALSE,
line_type = NULL,
line_color = "dodgerblue",
x_lab = "x",
y_lab = "y",
title_lab = NULL,
legend_lab = NULL,
double_yaxis = NULL,
list_extra = NULL,
from = NULL,
to = NULL,
scatter = NULL
)
Arguments
obj |
a valid |
slot_name |
string(s) with the name of the slot(s) to use in plotting. |
col_number |
numeric (vector) with the column's variable to plot. In case you decide to merge slots you must provide a list in which each element contains the column numbers of the variable to plot. |
interactive |
logical. Default value, |
line_type |
string with line dash type ( |
line_color |
string with a valid |
x_lab |
string with |
y_lab |
string with |
title_lab |
string with the title of the plot. Default is a plot without title. |
legend_lab |
string with plot label(s) name(s). NOTE: |
double_yaxis |
numeric vector with either |
list_extra |
list with the |
from |
string (or |
to |
string (or |
scatter |
numeric vector of length two with the column number to plot as scatter. The first variable (column number) will be the |
Value
A ggplot2
or plotly
objects to analyze your data.
Functions
-
plot_hydroMet,hydroMet_BDHI-method
: plot method for BDHI class -
plot_hydroMet,hydroMet_CR2-method
: plot method for CR2 class -
plot_hydroMet,hydroMet_DGI-method
: plot method for DGI class -
plot_hydroMet,hydroMet_IANIGLA-method
: plot method for IANIGLA class -
plot_hydroMet,hydroMet_compact-method
: plot method forcompact
class
Examples
# Path to file
dgi_path <- system.file('extdata', package = "hydroToolkit")
file_name <- list.files(path = dgi_path, pattern = 'Toscas')
# Read Toscas
var_nom <- list(slotNames(x = 'hydroMet_DGI')[2:7])
names(var_nom) <- file_name
# Load Toscas meteo station data
toscas_dgi <- create_hydroMet(class_name = 'DGI')
toscas_dgi <- build_hydroMet(obj = toscas_dgi, slot_list = var_nom, path = dgi_path)
# Plot mean air temperature
plot_hydroMet(obj = toscas_dgi, col_number = 2, slot_name = 'tmean',
legend_lab = 'Tmean(ºC)' )
# Now let's plot an interactive graph
plot_hydroMet(obj = toscas_dgi, col_number = 2, slot_name = 'tmean',
interactive = TRUE, y_lab = 'Tmean(ºC)' )