plot.ProjectProblem {oppr} | R Documentation |
Plot a solution to a project prioritization problem
Description
Create a plot to visualize how well a solution to a project prioritization
problem()
will maintain biodiversity.
Usage
## S3 method for class 'ProjectProblem'
plot(x, solution, n = 1, symbol_hjust = 0.007, return_data = FALSE, ...)
Arguments
x |
project prioritization |
solution |
|
n |
|
symbol_hjust |
|
return_data |
|
... |
not used. |
Details
The type of plot that this function creates depends on the problem objective. If the problem objective contains phylogenetic data, then this function plots a phylogenetic tree where each branch is colored according to its probability of persistence. Otherwise, if the problem does not contain phylogenetic data, then this function creates a bar plot where each bar corresponds to a different feature. The height of the bars indicate each feature's probability of persistence, and the width of the bars indicate each feature's weight.
Features that directly benefit from at least a single completely funded project with a non-zero cost are depicted with an asterisk symbol. Additionally, features that indirectly benefit from funded projects—because they are associated with partially funded projects that have non-zero costs and share actions with at least one funded project—are depicted with an open circle symbol.
Value
A ggplot()
object.
See Also
This function is essentially a wrapper for
plot_feature_persistence()
and
plot_phylo_persistence()
, so refer to the documentation
for these functions for more information.
Examples
# load data
data(sim_projects, sim_features, sim_actions)
# build problem without phylogenetic data
p1 <- problem(sim_projects, sim_actions, sim_features,
"name", "success", "name", "cost", "name") %>%
add_max_richness_objective(budget = 400) %>%
add_feature_weights("weight") %>%
add_binary_decisions()
## Not run:
# solve problem without phylogenetic data
s1 <- solve(p1)
# visualize solution without phylogenetic data
plot(p1, s1)
## End(Not run)
# build problem with phylogenetic data
p2 <- problem(sim_projects, sim_actions, sim_features,
"name", "success", "name", "cost", "name") %>%
add_max_phylo_div_objective(budget = 400, sim_tree) %>%
add_binary_decisions()
## Not run:
# solve problem with phylogenetic data
s2 <- solve(p2)
# visualize solution with phylogenetic data
plot(p2, s2)
## End(Not run)