plotNetwork: Plot variance-covariance networks

plotNetworkR Documentation

Plot variance-covariance networks

Description

Plot variance-covariance partition obtained using the function computeVarianceCovariancePartition of this package.

Usage

plotNetwork(
  variance_results = NULL,
  correlation_results = NULL,
  variance_type = NULL,
  correlation_type = NULL,
  group_variables = NULL,
  order_variables = NULL,
  edge_label = F,
  layout = "circular",
  only_significant = T,
  exclude_variables = NULL,
  correlation_threshold = 0,
  label_size = 0.8,
  node_label = NULL,
  plot_metrics = T,
  network_metrics_text_size = 1,
  degree_as_node_size = T
)

Arguments

variance_results

(data frame). Variance partition as reported by computeVarianceCovariance(). It can be found in "results_object$varianceResults.

correlation_results

(data frame). Correlations output of computeVarianceCovariance(). It can be found in "results_object$covarianceResults".

variance_type

(character). Name of the portion of variance to report in the nodes of the plot. When environmental variable is not included in computeVarianceCovariance(), it can be set as "phylogenetic_variance" or "non_phylogenetic_variance". If environmental variable is included, this argument can be set as "non_attributed_phylogenetic_variance", "environmental_phylogenetic_variance", "labile_environmental_variance" and "residual_variance".

correlation_type

(character). Name of the portion of the correlation to report in the edges of the plot. When environmental variable is not included in computeVarianceCovariance(), it can be set as "total_correlation", "phylogenetic_correlation" or "non_phylogenetic_correlation". If environmental variable is included, this argument can be set as "non_attributed_phylogenetic_correlation", "environmental_phylogenetic_correlation", "labile_environmental_correlation" and "residual_correlation".

group_variables

(data frame). Data frame wich a first column indicating the variables to be plotted included in correlation_results and varaince_results and the group of the variable in the second column. Variables of the same group will be ploted with the same colour.

order_variables

(character). Character indicating the variables names to be plotted in the desired order. The variables will be plotted in the desired order clockwise, when layout is set to be circular.

edge_label

(logical). If TRUE, edge labels show correlation coefficients. Default set to FALSE.

layout

("spring", or "circular"). Network layout (default as circular). See qgraph documentation for further information.

only_significant

(logical). if TRUE (default), only significant correlations are represented.

exclude_variables

(character). Vector of variables present in correlations data but excluded from the plot. It can be useful to plot subsets of the results.

correlation_threshold

(numeric). Only correlation with an absolute value higher than the threshold will be plotted. When set to zero, there is no threshold (default).

label_size

(numeric). Control the size of the node labels.

node_label

(data frame). Data frame indicating the variable name in the first column and the new name, which will be shown in the plot, in the second column.

plot_metrics

(logical). If true, network metrics are displayed.

network_metrics_text_size

(numeric). Size of the text reporting network metrics.

degree_as_node_size

(logical) If TRUE (default), node size is proportional to the degree of the variable (number of edges connected to a given node representing a variable).

Examples

## Not run: 
# Simulate example data
simulated_traits.data <- simulateDataSet()

# Compute variance-covariance structure for simulated traits using default parameters
variance_correlation_results <- computeVarianceCovariancePartition(
traits = c("phylo_G1_trait1", "phylo_G1_trait2"),
environmental_variable = "phylo_G1_env",
phylogeny = simulated_traits.data$phylogeny
)

# plot network

plotNetwork(
correlation_results = variance_correlation_results$covarianceResults,
variance_results = variance_correlation_results$varianceResults,
variance_type = environmental_phylogenetic_variance,
correlation_type = environmental_phylogenetic_covariance
)

## End(Not run)

pablosanchezmart/TrEvol documentation built on April 23, 2024, 4:05 p.m.