Useful to visualize e.g. the associations of the initial multivariate
gaussian distribution used by simdesign_mvtnorm
.
plot_cor_network(obj, ...)# S3 method for default
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 simdesign_mvtnorm
plot_cor_network(obj, ...)
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.
Correlation matrix or S3 class object which has a class method available (see below).
Passed to igraph::plot
, with a complete list
of arguments and details given in igraph.plotting
.
Vector of indices of variables which should be drawn as rectangles (i.e. represent categorical data).
Number of decimals, used for default labeling of the network edges.
Threshold of absolute correlation below which nodes are not considered as connected. Useful to control complexity of drawn network. Set to NULL to disable.
Character vector of length nrow(obj)
of labels for vertices. If not NULL,
overrides the vertex_label_prefix
argument. If set to NA omits all
or some vertex labels.
String which is added as prefix to node labels.
Function which takes one vector input (absolute correlation values) and outputs transformation of this vector (must be >= 0). Defines edge widths.
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.
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.
Function which takes one vector input (absolute correlation values) and
outputs transformation of this vector (must be >= 0). Defines edge weights.
Only relevant if use_edge_weights
is TRUE.
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.
If TRUE, the igraph
network object is returned and can be plotted by
the user using e.g. the interactive igraph::tkplot
function.
mar
argument to the par
function to set
margins of the plot (often required when the axes should be drawn).
A numerical vector of the form c(bottom, left, top, right) which gives the
number of lines of margin to be specified on the four sides of the plot.
The default is c(5, 4, 4, 2) + 0.1. Note that this is not the same argument
as the margin
argument for the igraph::plot.igraph
function.
Arguments to igraph::plot
, with sensible
defaults for this package's usage.
Argument passed to igraph::plot
. Usually a
character vector with a hex color specification for vertex color.
Alternatively a function that takes as input a data.frame with a column "id"
that gives the column number of the simulated data, and outputs a valid color
specification for the corresponding vertices (i.e. a single character hex
color or a vector of such hex colors of appropriate length).
Argument passed to igraph::plot
. This
package implements some special functionality: if edge.color = "ramp"
then
a colorramp from red (-1) via white (0) to blue (1) is mapped to the
correlations and the edges colored accordingly.
If edge.color = "clipped-ramp"
then the ramp is restricted to the
correlation values observed, which may be useful if they are low to increase
visibility.
If edge.color = "red-blue"
then all edges with positive correlation values
are colored uniformly red, and all edges with negative correlations are
colored uniformly blue. Alternatively, may be a function that takes as
input the edge correlation values and outputs valid color specifications
(i.e. a single hex color or a vector of hex colors of appropriate length).
plot_cor_network(default)
: Function to be used for correlation matrix.
plot_cor_network(simdesign_mvtnorm)
: Function to be used with simdesign_mvtnorm
S3 class object to visualize initial correlation network of the underlying
multivariate normal distribution.
For an explanation of all parameters not listed here, please refer to
igraph::plot
.
plot_cor_network.simdesign_mvtnorm
,
plot_estimated_cor_network