export | R Documentation |
This function creates an object built from the result returned
by miic
that is ready to be fed to the plotting method.
export(
miic_obj,
method = "igraph",
pcor_palette = NULL,
display = "compact",
show_self_loops = TRUE
)
miic_obj |
[a miic object, required] The object returned by the |
method |
[a string, optional, default value "igraph"] The plotting method, currently only "igraph" is supported. |
pcor_palette |
[a color palette, optional, default value grDevices::colorRampPalette(c("blue", "darkgrey", "red")] Used to represent the partial correlations (the color of the edges). The palette must be able to handle 201 shades to cover the correlation range from -100 to +100. |
display |
[a string, optional, default value "compact"] Used only when exporting object returned by miic in temporal mode. It allows different representations of the temporal graph. Possible values are "raw", "lagged", "compact", "combine", "unique", "drop":
|
show_self_loops |
[a boolean, optional, TRUE by default] Used only when exporting object returned by miic in temporal mode. When TRUE, the lagged edges starting and ending on the same node are included in the igraph object. When FALSE, only edges having different nodes are present in the igraph object. |
The behavior depends on the method used for the export.
For igraph, edge attributes are passed to the igraph graph
and can be accessed with e.g. E(g)$partial_correlation
.
See miic
for more details on edge parameters.
By default, edges are colored according to the partial correlation
between two nodes conditioned on the conditioning set
(negative is blue, null is gray and positive is red)
and their width is based on the conditional mutual information
minus the complexity cost.
A graph object adapted to the method.
library(miic)
data(hematoData)
# execute MIIC (reconstruct graph)
miic_obj <- miic(
input_data = hematoData, latent = "yes",
n_shuffles = 10, conf_threshold = 0.001
)
# Using igraph
if(require(igraph)) {
g = export(miic_obj, "igraph")
plot(g) # Default visualisation, calls igraph::plot.igraph()
# Specifying layout (see ?igraph::layout_)
l <-layout_with_kk(g)
plot(g, layout=l)
# Override some graphical parameters
plot(g, edge.curved = .2)
plot(g, vertex.shape="none", edge.color="gray85", vertex.label.color="gray10")
}
# In temporal mode, execute MIIC
data(covidCases)
tmiic_obj <- miic(input_data = covidCases, mode = "TS", n_layers = 3, delta_t = 1, mov_avg = 14)
# Plot by default the compact display of the temporal network using igraph
if(require(igraph)) {
g = export (tmiic_obj)
plot(g)
# Plot the raw temporal network using igraph
g = export(tmiic_obj, display="raw")
plot(g)
# Plot the complete temporal network using igraph (completed by stationarity)
g = export(tmiic_obj, display="lagged")
plot(g)
# Specifying layout (see ?igraph::layout_)
l <- layout_on_grid(g, width = 5, height = 3, dim = 2)
plot(g, layout=l)
# For compact temporal display, please be aware that the rendering of
# igraph::plot.igraph() is not optimal when the graph contains
# multiple edges between the same nodes.
# So, the recommend way to plot a compact graph is to use tmiic plotting:
plot(tmiic_obj)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.