R/plot.r

Defines functions plot.spillover_table

Documented in plot.spillover_table

#' @export
#' @title function to plot spillover tables
#' @param x An S3 object of the class spillover_table
#' @param ... not used
#' @return returns a ggplot object
plot.spillover_table <- function(x,...){

  # Melt the matrix
  tmp <- melt(t(x$spillover))

  # plot the graph
  p1 <-ggplot(tmp,aes(x=Var1,y=Var2,fill=value)) +
    geom_tile() +
    scale_fill_gradient(low="white",high="steelblue") +
    theme_bw() +
    xlab("Receiver") + ylab("Sender")

  return(p1)

}
joergrieger/bayesianConnectedness documentation built on July 31, 2019, 9:36 a.m.