R/plot_network_heatmap.R

Defines functions plot_network_heatmap

Documented in plot_network_heatmap

#' Plot network heatmap
#'
#' The function draws a heatmap to visualize a network
#'
#' @param net a numeric matrix of edge weights
#' @param colrs a range of colors to plot the network 
#'
#' @keywords
#' plot  heatmap image network
#'
#' @return null 
#'
#' @examples 
#' network <- cor(matrix( rnorm(10000), nrow=100))
#' plot_network_heatmap(network)
#'
#' @importFrom gplots colorpanel
#' @import graphics
#' @export
#'
plot_network_heatmap <- function(net, colrs) {
    
    if (missing(colrs)) {
        colrs <- gplots::colorpanel(100, "red", "blue")
    }
    nd <- node_degree(net)
    o <- order(nd)
    image(net[o, o], axes = FALSE, bty = "n", col = colrs)
    
} 

Try the EGAD package in your browser

Any scripts or data that you put into this service are public.

EGAD documentation built on Nov. 8, 2020, 8:31 p.m.