plot.tmiic: Basic plot function of a temporal miic (tmiic) network...

View source: R/tmiic.plot.R

plot.tmiicR Documentation

Basic plot function of a temporal miic (tmiic) network inference result

Description

This function calls export to build a plottable object from the result returned by miic in temporal mode and plot it.

Usage

## S3 method for class 'tmiic'
plot(
  x,
  method = "igraph",
  pcor_palette = NULL,
  display = "compact",
  show_self_loops = TRUE,
  positioning_for_grid = "greedy",
  orientation_for_grid = "L",
  ...
)

Arguments

x

[a tmiic object, required]

The object returned by miic in temporal mode.

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"]

Possible values are "raw", "lagged", "compact", "combine", "unique", "drop":

  • When display = "raw", the plot function will use the tmiic graph object as it, leading to the display of a lagged graph. Unless a specific layout is specified, nodes will be positioned on a grid.

  • When display = "lagged", the function will repeat the edges over history assuming stationarity and plot a lagged graph. Unless a specific layout is specified, nodes will be positioned on a grid.

  • When display = "compact", the default, nodes and edges are converted into a flattened version to produce a compact view of the temporal network whilst still presenting all the information in the plotting.
    e.g. X_lag1->Y_lag0, X_lag2<-Y_lag0 become respectively X->Y lag=1, X<-Y lag=2.

  • When display = "combine", prior to the plotting, a pre-processing will be applied to kept only one edge per pair of nodes. The info_shifted will be the highest one of the summarized edges whilst the lag and orientation of the summarized edge will be an aggregation.
    e.g. X_lag1->Y_lag0, X_lag2<-Y_lag0 will become X<->Y lag=1,2 with the info_shifted of X_lag1->Y_lag0 if info_shifted of X_lag1->Y_lag0 > X_lag2<-Y_lag0.

  • When display = "unique", prior to the plotting, a pre-processing will be applied to kept only the edges having the highest info_shifted for a pair of nodes. If several edges between the sames nodes have the same info_shifted, then the edge kept is the one with the minimum lag.
    e.g. X_lag1->Y_lag0, X_lag2<-Y_lag0 with info_shifted of X_lag1->Y_lag0 > X_lag2<-Y_lag0 become X->Y lag=1.

  • When display = "drop", the same pre-processing as "unique" will be applied, then the lag information will be dropped and will not be displayed on the final plotting.

show_self_loops

[a boolean, optional, TRUE by default]

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.

positioning_for_grid

[a string, optional, "greedy" by default]

Used only when the display is "raw" or "lagged" and no layout is supplied. Possible values are "none", "alphabetical", "layers", "greedy" and "sugiyama"

  • When positioning_for_grid = "none" The nodes are positioned as they appear in the miic result

  • When positioning_for_grid = "alphabetical" The nodes are positioned alphabetically in ascending order

  • When positioning_for_grid = "layers" The nodes with the less lags will be placed on the exteriors while the nodes having the most lags are in the center

  • When positioning_for_grid = "greedy" A greedy algorithm will be used to placed the nodes in a way minimizing the crossing edges

  • When positioning_for_grid = "sugiyama" The sugiyama algorithm will be used to placed the nodes in a way minimizing the crossing edges

orientation_for_grid

[a string, optional, "L" by default]

Used only when the display is "raw" or "lagged and no layout is supplied. Indicates the orientation of the draw, possible values are landscape: "L" or portrait: "P".

...

Additional plotting parameters. See the corresponding plot function for the complete list.

For igraph, see igraph.plotting.

Details

See the documentation of export for further details.

See Also

export for graphical exports, igraph.plotting

Examples


library(miic)

#' # EXAMPLE COVID CASES (time series demo)
data(covidCases)
# execute MIIC (reconstruct graph in temporal mode)
tmiic_obj <- miic(input_data = covidCases, mode = "TS", n_layers = 3, delta_t = 1, mov_avg = 14)

# to plot the default compact graph
if(require(igraph)) {
  plot(tmiic_obj)
}

# to plot the raw temporal network
if(require(igraph)) {
  plot(tmiic_obj, display="raw")
}

# to plot the full temporal network
if(require(igraph)) {
  plot(tmiic_obj, display="lagged")
}



miic documentation built on Sept. 18, 2024, 1:07 a.m.

Related to plot.tmiic in miic...