Graph Attributes

Where possible, GraphRecipes will adopt attributes from Plots.jl to format visualizations. For example, the linewidth attribute from Plots.jl has the same effect in GraphRecipes. In order to give the user control over the layout of the graph visualization, GraphRecipes provides a number of keyword arguments (attributes). Here we describe those attributes alongside their default values.

AttributeAliasesDefaultDescription
dim2The number of dimensions in the visualization.
TFloat64The data type for the coordinates of the graph nodes.
curvestrueWhether or not edges are curved. If `curves == true`, then the edge going from node $s$ to node $d$ will be defined by a cubic spline passing through three points: (i) node $s$, (ii) a point `p` that is distance `curvature_scalar` from the average of node $s$ and node $d$ and (iii) node $d$.
curvature_scalarcurvaturescalar, curvature0.05A scalar that defines how much edges curve, see `curves` for more explanation.
root:topFor displaying trees, choose from `:top`, `:bottom`, `:left`, `:right`. If you choose `:top`, then the tree will be plotted from the top down.
node_weightsnodeweightsnothingThe weight of the nodes given by a list of numbers. If `node_weights != nothing`, then the size of the nodes will be scaled by the `node_weights` vector.
names[]Names of the nodes given by a list of objects that can be parsed into strings. If the list is smaller than the number of nodes, then GraphRecipes will cycle around the list.
fontsize7Font size for the node labels and the edge labels.
nodeshapenode_shape:hexagonShape of the nodes, choose from `:hexagon`, `:circle`, `:ellipse`, `:rect` or `:rectangle`.
nodesizenode_size0.1The size of nodes in the plot coordinates. Note that if `names` is not empty, then nodes will be scaled to fit the labels inside them.
nodecolormarker_color1The color of the nodes. If `nodecolor` is an integer, then it will be taken from the current color pallette. Otherwise, the user can pass any color that would be recognised by the Plots `color` attribute.
x, y, zxnothingThe coordinates of the nodes.
method:stressThe method that GraphRecipes uses to produce an optimal layout, choose from `:spectral`, `:sfdp`, `:circular`, `:shell`, `:stress`, `:spring`, `:tree`, `:buchheim`, `:arcdiagram` or `:chorddiagram`. See [NetworkLayout](https://github.com/JuliaGraphs/NetworkLayout.jl) for further details.
funcget(_graph_funcs, method, by_axis_local_stress_graph)A layout algorithm that can be passed in by the user.
shortenshorten_edge0.0An amount to shorten edges by.
axis_bufferaxisbuffer0.2Increase the `xlims` and `ylims`/`zlims` of the plot. Can be useful if part of the graph sits outside of the default view.
layout_kwDict{Symbol,Any}()A list of keywords to be passed to the layout algorithm, see [NetworkLayout](https://github.com/JuliaGraphs/NetworkLayout.jl) for a list of keyword arguments for each algorithm.
edgewidthedge_width, ew(s, d, w) -> 1The width of the edge going from $s$ to node $d$ with weight $w$.
edgelabeledge_label, elnothingA dictionary of `(s, d) => label`, where `s` is an integer for the source node, `d` is an integer for the destiny node and `label` is the desired label for the given edge. Alternatively the user can pass a vector or a matrix describing the edge labels. If you use a vector or matrix, then either `missing`, `false`, `nothing`, `NaN` or `""` values will not be displayed. In the case of multigraphs, triples can be used to define edges.
edgelabel_offsetedgelabeloffset, elo0.0The distance between edge labels and edges.
self_edge_sizeselfedgesize, ses0.1The size of self edges.
edge_label_boxedgelabelbox, edgelabel_box, elbtrueA box around edge labels that avoids intersections between edge labels and the edges that they are labeling.

Aliases

Certain keyword arguments have aliases, so GraphRecipes "does what you mean, not what you say".

So for example, nodeshape=:rect and node_shape=:rect are equivalent. To see the available aliases, type GraphRecipes.graph_aliases. If you are unhappy with the provided aliases, then you can add your own:

using GraphRecipes, Plots

push!(GraphRecipes.graph_aliases[:nodecolor],:nc)

# These two calls produce the same plot, modulo some randomness in the layout.
plot(graphplot([0 1; 0 0], nodecolor=:red), graphplot([0 1; 0 0], nc=:red))

(Automatically generated: Tue, 25 Jul 2023 15:35:05)