Skip to contents

Drawing heatmap() using an nethist object with an user-specified order.

Usage

# S3 method for nethist
plot(
  x,
  type = "nethist",
  idx_order = 1:max(x$cluster),
  prob = FALSE,
  digits = 2,
  prob.cex = 0.1 + 0.5/log10(max(x$cluster)),
  prob.col = "black",
  y = NA,
  ...
)

Arguments

x

a nethist object from nethist().

type

One of nethist or prob.

idx_order

A numeric vector for index label order, which must be a permutation of x$cluster. If NA, it uses 1:max(x$clsuter).

prob

A logical variable indicating block probabilities are printed on the plot. Default is FALSE.

digits

integer indicating the number of decimal places for probability

prob.cex

A numerical value of cex of probabilities.

prob.col

A color vector for network histogram values/probabilities on each bin.

y

a dummy variable for S3 methods. Never used in the plotting.

...

other arguments to pass to stats::heatmap(). See details.

Value

a heatmap of network histogram or p_mat ordered by idx_order from nethist object.

Details

... includes various graphical parameters passes to stats::heatmap(), then graphics::image().

Examples

if (FALSE) {
set.seed(2022)
#Generating Erdos-Renyi graph
A <- igraph::sample_gnp(200, 0.05)
hist_A <- nethist(A)
plot(hist_A)

#with user-specified order
idx<- unique(hist_A$cluster) 
plot(hist_A, idx_order = idx)

#User-speicifc bin color pallete (see [graphical parameters])
plot(hist_polblog,  idx_order = ind, col = colorRampPalette(colors=c("#FFFFFF","#000000"))(50))

#Users can print p_mat on the plot using user-specific colors
plot(hist_polblog,  idx_order = ind, prob= TRUE, prob.col = "blue",
      col = colorRampPalette(colors=c("#FFFFFF","#000000"))(50))
}