Skip to contents

Visualise the citation network of top-cited works.

Usage

sm_plot_citation_network(
  corpus,
  top_n = 50L,
  dark = FALSE,
  precompute = FALSE,
  max_nodes = NULL,
  ...
)

Arguments

corpus

An sm_corpus.

top_n

Number of top works to include.

dark

Logical; dark mode?

precompute

Logical (default FALSE). When TRUE, the graph layout is computed eagerly and a plain self-contained ggplot (materialised coordinates) is returned, instead of a lazy ggraph object. Use this when embedding the plot in an RMarkdown/knitr/callr/workflowr document: the heavy layout runs once here rather than in the (often memory-limited) render subprocess, where large ggraph objects can crash the harness.

max_nodes

Optional integer node cap. NULL (default) keeps all nodes so existing renders are unchanged; set it to downsample large graphs to the highest-degree nodes (opt-in, with a cli message).

...

Additional arguments.

Value

A ggplot object (a ggraph plot when precompute = FALSE, a plain ggplot when precompute = TRUE).

Large graphs

For big networks, prefer precompute = TRUE and save the returned object (e.g. with saveRDS()); printing it in a document then re-renders cheaply without recomputing the layout. See the networks section of the getting- started vignette.

Examples

corpus <- sm_example_corpus()
sm_plot_citation_network(corpus)