#' @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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.