Plot the desired data from a site object
1 2 3 4 5 6 7 8
sfn_data object to plot. It can be also an sfn_data_multi object.
Character indicating which data to plot. See Type section for detailed information about the available values. Ignored if formula is provided
Right side formula indicating an environmental variable to
plot vs. the sapflow values. If NULL (default),
Logical indicating if the solar timestamp must be used instead of the site timestamp
Further arguments to be passed on
A ggplot object that can be called to see the plot. If input is an sfn_data_multi object, a list with the plots
plot is a base R function which uses the base R plotting system
to show the plot. We prefer the ggplot plotting system, which allow for
storing the plots in objects and can be subjected to further modifications.
This allow the package users to generate rather simple plots that can be
fine tuned afterwards to the user taste. Generating a
method for the
sfn_data class returning a ggplot object is not
desired (it change the way plot works and can be misleading about the plot
general usage). So, instead, we offer this function,
type argument controls what is going to be plotted. It accepts
"sapf": It will plot sapflow data vs. TIMESTAMP
"env": It will plot environmental variables vs. TIMESTMAP
"ta", "rh", "vpd", "ppfd_in", "netrad", "sw_in", "ext_rad", "ws", "precip", "swc_shallow" and "swc_deep": They will plot the corresponding variable vs. TIMESTAMP
formula argument can be used to select an environmental variable to
plot versus all the sapflow measurements. Any envirinmental variable is
allowed, if it exist in the site provided.
sfn_plot generates plots using
geometry, except in the case of
type = "ws" and
type = "precip" where
geom_col is used. These
geometries can be modified with the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
library(ggplot2) # data data('ARG_TRE', package = 'sapfluxnetr') # plotting directly sfn_plot(ARG_TRE, type = 'sapf') # this could be noisy, you can facet by "Tree" (for sapflow) or by # "Variable" (for environmental data): sfn_plot(ARG_TRE, type = 'sapf') + facet_wrap(~ Tree) sfn_plot(ARG_TRE, type = 'env') + facet_wrap(~ Variable, scales = 'free_y') # saving and modifying: env_plot <- sfn_plot(ARG_TRE, type = 'env', solar = FALSE) + facet_wrap(~ Variable, scales = 'free_y') env_plot + labs(title = 'Environmental variables facet plot') # formula sfn_plot(ARG_TRE, formula_env = ~ vpd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.