plot.cascade {NetworkInference}R Documentation

Plot a cascade object

Description

Allows plotting of one or multiple, labeled or unlabeled cascades.

Usage

## S3 method for class 'cascade'
plot(x, label_nodes = TRUE, selection = NULL, ...)

Arguments

x

object of class cascade to be plotted.

label_nodes

logical, indicating if should the nodes in each cascade be labeled. If the cascades are very dense setting this to FALSE is recommended.

selection

a vector of cascade ids to plot.

...

additional arguments passed to plot.

Details

The function returns a ggplot plot object (class gg, ggplot) which can be modified like any other ggplot. See the ggplot documentation and the examples below for more details.

Value

A ggplot plot object.

Examples


data(cascades)
plot(cascades, selection = names(cascades$cascade_nodes)[1:5])
plot(cascades, label_nodes = FALSE, selection = sample(1:54, 20))

# Modify resulting ggplot object
library(ggplot2) 
p <- plot(cascades, label_nodes = FALSE, selection = sample(1:54, 20))
## Add a title
p <- p + ggtitle('Your Title')
p
## Change Axis
p <- p + xlab("Your modified y axis label") #x and y labels are flipped here
p <- p + ylab("Your modified x axis label") #x and y labels are flipped here
p


[Package NetworkInference version 1.2.4 Index]