plot_cor_network {simdata} | R Documentation |
Visualize fixed correlation structure as a network
Description
Useful to visualize e.g. the associations of the initial multivariate
gaussian distribution used by simdesign_mvtnorm
.
Usage
plot_cor_network(obj, ...)
## Default S3 method:
plot_cor_network(
obj,
categorical_indices = NULL,
decimals = 2,
cor_cutoff = 0.1,
vertex_labels = NULL,
vertex_label_prefix = "z",
edge_width_function = function(x) x * 10,
edge_label_function = function(x) round(x, decimals),
use_edge_weights = FALSE,
edge_weight_function = base::identity,
seed = NULL,
return_network = FALSE,
mar = c(0, 0, 0, 0),
vertex.size = 12,
margin = 0,
asp = 0,
vertex.color = "#ececec",
vertex.frame.color = "#979797",
vertex.label.color = "black",
edge.color = "ramp",
edge.label.color = "black",
edge.label.cex = 0.8,
...
)
## S3 method for class 'simdesign_mvtnorm'
plot_cor_network(obj, ...)
Arguments
obj |
Correlation matrix or S3 class object which has a class method available (see below). |
... |
Passed to |
categorical_indices |
Vector of indices of variables which should be drawn as rectangles (i.e. represent categorical data). |
decimals |
Number of decimals, used for default labeling of the network edges. |
cor_cutoff |
Threshold of absolute correlation below which nodes are not considered as connected. Useful to control complexity of drawn network. Set to NULL to disable. |
vertex_labels |
Character vector of length |
vertex_label_prefix |
String which is added as prefix to node labels. |
edge_width_function |
Function which takes one vector input (absolute correlation values) and outputs transformation of this vector (must be >= 0). Defines edge widths. |
edge_label_function |
Function which takes on vector input (absolute correlation values) and outputs labels for these values as character vector. Defines edges labels. If set to NULL, then no edge labels will be displayed. |
use_edge_weights |
Logical, if TRUE then the layout will be influenced by the absolute correlations (i.e. edge weights) such that highly correlated variables will be put closer together. If FALSE, then the layout is independent of the correlation structure. |
edge_weight_function |
Function which takes one vector input (absolute correlation values) and
outputs transformation of this vector (must be >= 0). Defines edge weights.
Only relevant if |
seed |
Set random seed to ensure reproducibility of results. Can be fixed to obtain same layout but vary edge widths, correlation functions etc. Can also be used to obtain nicer looking graph layouts. |
return_network |
If TRUE, the |
mar |
|
vertex.size , margin , asp , vertex.frame.color , vertex.label.color , edge.label.color , edge.label.cex |
Arguments to |
vertex.color |
Argument passed to |
edge.color |
Argument passed to |
Details
For an explanation of all parameters not listed here, please refer to
igraph::plot
.
Value
If return_network
is TRUE
, then an igraph
network object is returned
that can be plotted by the user using e.g. the interactive
igraph::tkplot
function. Otherwise, the network
object is plotted directly and no output is returned.
Methods (by class)
-
plot_cor_network(default)
: Function to be used for correlation matrix. -
plot_cor_network(simdesign_mvtnorm)
: Function to be used withsimdesign_mvtnorm
S3 class object to visualize initial correlation network of the underlying multivariate normal distribution.
See Also
plot_cor_network.simdesign_mvtnorm
,
plot_estimated_cor_network