Create a ggraph plot
This function is the equivalent of
ggplot in ggplot2.
It takes care of setting up the plot object along with creating the layout
for the plot based on the graph and the specification passed in.
Alternatively a layout can be prepared in advance using
create_layout and passed as the data argument. See Details for
a desciption of all available layouts.
ggraph(graph, layout = "auto", ...)create_layout(graph, layout, circular, ...)"create_layout"(graph, layout, ...)"create_layout"(graph, layout, circular = FALSE, ...)"create_layout"(graph, layout, circular = FALSE, ...)"create_layout"(graph, layout, circular = FALSE, ...)"create_layout"(graph, layout, circular = FALSE, ...)
- The object containing the graph. See Details for a list
of supported classes. Or a
layout_ggraphobject as returned from
create_layoutin which case all subsequent arguments is ignored.
- The type of layout to create.
- Arguments passed on to the layout function.
- Should the layout be transformed into a radial
representation. Only possible for some layouts. Defaults to
Following is a short description of the different layout types available in ggraph. Each layout is further described in its own help pages.
dendrogram class is used to store binary tree from
e.g. hierarchical clustering. The layouts provided for this class is
constrained to tree-like representations.
are supported through automatic conversion to dendrogram objects and thus
supports the same layouts.
Further, if the layouts provided for igraph objects are needed for dendrogram
den_to_igraph is provided to convert dendrograms to
Any type of regular graph/network data can be represented as an igraph
object. Because of this the different layouts that can be applied to igraph
objects are quite diverse, but not all layouts makes sense to all types of
graphs. It is up to the user to understand their data and choose an
appropriate layout. For standard node-edge diagrams igraph itself defines a
long range of different layout functions that are all available through the
igraph layout where the specific layout is specified using the
algorithm argument. In order to minimize typing all igraph algorithms
can also be passed directly into the
network objects are supported by automatic conversion
to igraph objects using
network_to_igraph and thus supports the
ggraph()an object of class gg onto which layers, scales, etc. can be added. For
create_layout()an object inherting from
layout_ggraphitself inherits from
data.frameand can be considered as such. The data.frame contains the node positions in the
ycolumn along with additional columns generated by the specific layout, as well as node parameters inherited from the graph. Additional information is stored as attributes to the data.frame. The original graph object is stored in the
graphattribute and the
circularattribute contains a logical indicating whether the layout has been transformed to a circular representation.
require(igraph) gr <- make_graph('bull') layout <- create_layout(gr, layout = 'igraph', algorithm = 'kk')