display_mortality.Rd
Display Mortality Rates with ggplot2
display_mortality( mortality = NULL, type = "line", time_col = "time", color_col = "plot", faceting = FALSE, title = "Annual mortality rates in function of time.", subtitle = NULL, save_graph = FALSE, device = "png", path_save = file.path("ForestGraphs", paste0("annual_mortality_", type, ".png")), name = "Annual Mortality rates for each between-census interval", create_folder = FALSE, overwrite = FALSE, ... )
mortality | data.frame, output of compute_mortality |
---|---|
type | character, partially matching one of the following: "line", "histogram", "bar", "smooth". For the moment, only "line" is implemented, being the most relevant in this case. Corresponds to the type of graph to be done, for examples see ggplot2 examples for geom_line, geom_histogram, geom_bar and geom_smooth. |
time_col | Character, name of the column corresponding to census time |
color_col | Character, name of the colomn used to define lines' colors, defaults to "Plot". |
faceting | Character, name of the variable used for faceting -see after- but defaults to FALSE i.e. no faceting. Faceting refers, here, to using a categorical, grouping variable to layout multiple plots, each corresponding to a category of the grouping variable. For example, one can do a single graph per station -if there are several forest plots in each station-, or one per taxon if looking to several specific taxa' mortality and recruitment rates in detail. If offers the advantage to avoir plotting too much information on a graph, but it can lead to difficulties to compare lines with one another. The scales are free on the x axis -basically, it correspond to several groups not necessarily having the same censusing temporal resolution-, but are bound on y -i.e., the rates are displayed on the same scale for comparison purposes. |
title | Character,title of the graph. |
subtitle | Character, defaulting to null. The subtitle of the graph |
save_graph | Logical, indicates whether the graph must be saved or not. If TRUE, please set the above described arguments in an appropriate way. |
device | Character, the graphical device to be used to save the graph |
path_save | Character, a path indicating in which FOLDER the graph has to be saved |
name | Character, the name of the folder containing the graph. It can be followd by the extension corresponding to the device - avoid .jpg for the jpeg device, use .jpeg instead. If the extension is missing, it is automatically added according to the selected device. |
create_folder | Logical, indicated whether the folders in the given path must be created in case they do not exist yet, or not |
overwrite | Logical, indicating whether a file already existing under the same name must be overwritten, or kept. In the second case, the function aborts with an explicit error message. |
... | additional graphical arguments to pass to ggplot's functions |
A ggplot2 graphical object.