Skip to contents

This function plots a network object as a directed graph using ggplot2. Nodes represent neurons, and directed edges represent connections between them. The plot can be customized by selecting which motif to display and how to color the edges.

Usage

# S3 method for class 'network'
plot(
  network,
  title = NULL,
  plot_motif = "local connections",
  edge_color = "pre_type",
  cell_color = "layer",
  cell_size_factor = 5,
  arrow_size_factor = 0.5,
  return_plot = FALSE
)

Arguments

network

Network object to plot.

title

Title for the plot (default: "Cortical Patch" or network name (if provided), plus plot motif name(s)).

plot_motif

Character string specifying which motif to plot; options include "local" for local connections within each node or the name of a long-range projection motif (default: "local connections").

edge_color

Character string specifying how to color the edges; options include "pre_type" to color by presynaptic neuron type, "post_type" to color by postsynaptic neuron type, or "motif" to color by motif type (default: "pre_type").

cell_color

Character string specifying how to color the nodes; options include "layer" to color by layer index or "type" to color by neuron type (default: "layer").

cell_size_factor

Numeric value controlling how cell size in the plot scales to the number of cells.

return_plot

Logical indicating whether to return the ggplot object (TRUE) or print the plot directly (FALSE) (default: FALSE).

arrow_size

Numeric value indicating the size of the arrows representing edges (default: 0.05).

Value

Either prints the plot directly or returns the ggplot object, depending on the value of return_plot.