get_taxon_graph | R Documentation |
This function loads the taxon index for either of the NCBI or GBIF
taxa present in a dataset (see get_taxa
) and creates a
taxonomic graph for the dataset using the igraph package.
get_taxon_graph(record, which = c("gbif", "ncbi"))
record |
A single dataset record id |
which |
Return the GBIF or NCBI taxon graph |
The graph vertices are the different taxa used in the dataset along
with nodes for all parent taxa of those taxa. The graph vertex
names are arbitrary strings (tx1, ...) but the vertex attributes
contain the worksheet name, validated taxon name, taxon rank and taxon
status (see names(vertex_attr(obj))
).
An graph
object.
set_example_safedata_dir()
beetle_graph <- get_taxon_graph(1400562)
plot(beetle_graph, vertex.label.cex = 0.6, vertex.size = 15,
vertex.size2 = 3, vertex.shape = "rectangle")
# show worksheet names for tips
wsn <- igraph::vertex_attr(beetle_graph, "worksheet_name")
txn <- igraph::vertex_attr(beetle_graph, "taxon_name")
labels <- ifelse(is.na(wsn), txn, wsn)
is_leaf <- igraph::vertex_attr(beetle_graph, "leaf")
vert_col <- ifelse(is_leaf, "cornflowerblue", "grey")
plot(beetle_graph, vertex.label.cex = 0.6, vertex.size = 15,
vertex.size2 = 3, vertex.shape = "rectangle",
vertex.label = labels, vertex.color= vert_col)
set_example_safedata_dir(on=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.