A hoverbox is a box of text that shows up when the cursor hovers over something. These can be useful when making interactive network plots of the HPO phenotypes because we can include a hoverbox that gives information and data associated with each phenotype.

add_hoverboxes(
  g,
  columns = get_graph_colnames(g),
  hoverbox_column = c("hover", "title", "label"),
  width = 60,
  digits = 3,
  decorators = c("<b>", "</b>"),
  as_html = TRUE,
  force_new = FALSE
)

Arguments

g

tbl_graph object.

columns

Character vector of column names to include in the hoverbox.

hoverbox_column

Name of the new hoverbox column to add.

width

Positive integer giving target line width (in number of characters). A width less than or equal to 1 will put each word on its own line.

digits

integer indicating the number of decimal places (round) or significant digits (signif) to be used. For round, negative values are allowed (see ‘Details’).

decorators

Left and right decorators to add to the hoverbox titles.

as_html

Provide the hoverbox in HTML format.

force_new

Add the data again even if the associated column already exists.

Value

tidygraph with additional metadata column named "hover".

Examples

ont <- get_ontology("hp")
#> Loading cached ontology: /github/home/.cache/R/KGExplorer/hp.rds
g <- ontology_to(ont, to="tbl_graph")
#> Translating ontology terms to ids.
#> Converted ontology to: tbl_graph 
g2 <- add_hoverboxes(g)
#> Making hoverboxes from: 'name', 'short_id', 'label', 'namespace', 'definition', 'IC', 'depth', 'n_children', 'n_ancestors', 'n_parents', 'n_offspring', 'n_connected_leaves', 'ancestor', 'ancestor_name', 'n_edges', 'ontLvl'
#> Adding hoverboxes to data.table.