Convert an igraph to data for a 3D plotly plot.
graph_to_plotly(
  g,
  ont = get_ontology("hpo"),
  layout_func = igraph::layout.fruchterman.reingold,
  dim = 3,
  id_col = "name",
  label_var = "hpo_name",
  seed = 2023
)ggnetwork object (or an igraph/tbl_graph to be converted to ggnetwork format).
An ontology of class ontology_DAG.
Layout function for the graph.
Number of dimensions to create layout in.
Column containing unique ID per term.
Column containing the label for each node in a graph (e.g. "hpo_name").
Set the seed for reproducible clustering.
Named list of data.frames.
ont <- get_ontology("hp", terms=10)
#> Using cached ontology file (1/1):
#>  /github/home/.cache/R/KGExplorer/ontologies/github/hp_v2025-05-06.rds
#> Randomly sampling 10 term(s).
g <- ontology_to(ont, to="tbl_graph")
#> Translating ontology terms to ids.
#> Converted ontology to: tbl_graph 
p <- graph_to_plotly(g)
#> Converting igraph to plotly data.
#> Translating ontology terms to names.
#> Using cached ontology file (1/1):
#>  /github/home/.cache/R/KGExplorer/ontologies/github/hp_v2025-05-06.rds