plot_user_network: Create a network plot displaying the adjacency of users.

View source: R/plots.R

plot_user_networkR Documentation

Create a network plot displaying the adjacency of users.

Description

The network graph is constructed by putting users into close proximity based on their shared joined rooms.

Usage

plot_user_network(
  rooms,
  joined_threshold = 2,
  user_blacklist = NULL,
  shared_threshold = 2,
  show_labels = TRUE,
  label_threshold = 5,
  label_whitelist = NULL
)

Arguments

rooms

Rooms object to use. See rooms().

joined_threshold

Minimum number of joined rooms for including a user.

user_blacklist

User IDs that should be excluded.

shared_threshold

Minimum number of shared rooms for including a connection between two users. The default value is 2 to accomodate the fact, that all users share a room with the user doing the request.

show_labels

Whether to show labels. This parameter does not apply to the users on the label_whitelist.

label_threshold

Minimum number of joined rooms for labeling a user.

label_whitelist

User IDs that should be labeled.

Value

An igraph object for plotting. See igraph::igraph.plotting for information on tweaking the visuals.

Examples


# Retrieve some rooms (in this case all joined rooms):

initial_sync <- sync()

rooms <- get_rooms(
  all_rooms(initial_sync),
  since = lubridate::today(),
  initial_sync
)

# Create the network graph:

graph <- plot_user_network(rooms)

# Plot the graph tweaking some of the visuals:

plot(
  graph,
  edge.color = "#BBBBBB1A",
  vertex.frame.color = NA,
  vertex.color = "#303030AA"
)


GregSutcliffe/ChatStat documentation built on March 18, 2022, 8:51 a.m.