plot_hisafe_cycle_bar: Plot annual barchart of major cycles

Description Usage Arguments Details Value See Also Examples

View source: R/cycles.R

Description

Plots an annual barchart of tree carbon pools, water fluxes, nitrogen fluxes, or light capture.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
plot_hisafe_cycle_bar(
  hop,
  cycle,
  freq = "year",
  simu.names = "all",
  tree.ids = "all",
  years = "all",
  months = "all",
  date.min = NA,
  date.max = NA,
  doy.start = 1,
  color.palette = NULL,
  bar.color = "black",
  crop.names = c("Main crop", "Inter crop"),
  plot = TRUE,
  tidy = plot
)

Arguments

hop

An object of class hop or face.

cycle

One of "carbon", "nitrogen", "water", "light", or "yield".

freq

One of "year", "month", "day".

simu.names

A character vector of the SimulationNames within hop to include. Use "all" to include all available values.

tree.ids

A numeric vector indicating a subset of tree ids to plot. Use "all" to include all available values. This only applies when cycle is "carbon".

doy.start

The JulianDay [1-365] on which to start the annual cycle accounting. Use 'sim' to specify the starting JulianDay of the simulation.

color.palette

A character string of hex values or R standard color names defining the color palette to use in plots with multiple simulations. If NULL, the default, then the default color palette is a color-blind-friendly color palette.

bar.color

A hex value or R standard color name defining the color to use for bar plot borders

crop.names

A character vector of length 2 containing the names to use in the legend for the mainCrop and interCrop of Hi-sAFe, in that order.

plot

If TRUE, the default, a ggplot object is returned. If FALSE, the data that would create the plot is returned.

tidy

If TRUE, the summqrized version of the budget is created. Otherwise, a fully expanded budget is created.

year.lim

A numeric vector of length two providing the c(minimum, maximum) of calendar years to plot. If no input, the full available time range is plotted. Use NA to refer to the start or end of the simulation.

Details

Detailed description of the flux components of the nitrogen and water cycles:

NITROGEN

WATER

Value

If plot = TRUE, returns a ggplot object. If plot = FALSE, returns the data that would create the plot. If hop contains more than one simulation, the plot will be faceted by SimulationName.

See Also

Other hisafe analysis functions: LER_summary(), LER(), analyze_hisafe(), cycle_summary(), hisafe_budget(), plot_hisafe_cycle_ts(), stics_budget_comp(), write_hop()

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
# To plot the simulated water cycle:
water.plot <- plot_hisafe_cycle_bar(myhop, "water")

# Once you have the plot object, you can display it and save it:
water.plot
ggsave_fitmax("water_cycle.png", water.plot)

## End(Not run)

kevinwolz/hisafer documentation built on Oct. 19, 2020, 4:43 p.m.