Skip to content
Back to skills

Ggraph

ASecurity

R ggraph package for network visualization. Use for grammar of graphics style network plots.

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 4, 2026
datagonode

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill ggraph --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ggraph?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ggraph
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-ggraph/badge)](https://www.skillsdirectory.com/skills/leolin990405-ggraph)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ggraph
description: R ggraph package for network visualization. Use for grammar of graphics style network plots.
---

# ggraph Package

Grammar of graphics for networks.

## Basic Plot

```r
library(ggraph)
library(tidygraph)

graph <- as_tbl_graph(igraph_obj)

ggraph(graph, layout = "fr") +
  geom_edge_link() +
  geom_node_point()
```

## Layouts

```r
# Force-directed
ggraph(graph, layout = "fr")  # Fruchterman-Reingold
ggraph(graph, layout = "kk")  # Kamada-Kawai
ggraph(graph, layout = "stress")

# Hierarchical
ggraph(graph, layout = "tree")
ggraph(graph, layout = "dendrogram")

# Circular
ggraph(graph, layout = "circle")
ggraph(graph, layout = "linear", circular = TRUE)

# Manual
ggraph(graph, layout = "manual", x = x_coords, y = y_coords)
```

## Edge Geoms

```r
# Links
geom_edge_link(aes(alpha = weight))
geom_edge_link2(aes(color = node.class))  # Gradient

# Arcs
geom_edge_arc(aes(alpha = weight))
geom_edge_fan()  # Multiple edges

# Curved
geom_edge_bend()
geom_edge_diagonal()

# Arrows
geom_edge_link(arrow = arrow(length = unit(2, "mm")))
```

## Node Geoms

```r
geom_node_point(aes(size = degree, color = community))
geom_node_text(aes(label = name), repel = TRUE)
geom_node_label(aes(label = name))
geom_node_tile()  # For treemaps
```

## Full Example

```r
graph %>%
  mutate(
    degree = centrality_degree(),
    community = as.factor(group_louvain())
  ) %>%
  ggraph(layout = "fr") +
  geom_edge_link(alpha = 0.3) +
  geom_node_point(aes(size = degree, color = community)) +
  geom_node_text(aes(label = name), repel = TRUE, size = 3) +
  scale_size_continuous(range = c(2, 10)) +
  theme_graph() +
  labs(title = "Network Visualization")
```

## Faceting

```r
ggraph(graph, layout = "fr") +
  geom_edge_link() +
  geom_node_point() +
  facet_nodes(~community)

ggraph(graph, layout = "fr") +
  geom_edge_link() +
  geom_node_point() +
  facet_edges(~type)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.