All Projects → JuliaGraphs → GraphPlot.jl

JuliaGraphs / GraphPlot.jl

Licence: other
Graph visualization for Julia.

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to GraphPlot.jl

Neo4jd3
Neo4j graph visualization using D3.js
Stars: ✭ 843 (+392.98%)
Mutual labels:  graph-visualization
GNNLens2
Visualization tool for Graph Neural Networks
Stars: ✭ 155 (-9.36%)
Mutual labels:  graph-visualization
noflo-graphviz
NoFlo visualization tools for GraphViz
Stars: ✭ 14 (-91.81%)
Mutual labels:  graph-visualization
Pynms
A vendor-agnostic NMS for carrier-grade network simulation and automation
Stars: ✭ 73 (-57.31%)
Mutual labels:  graph-visualization
Jira Dependency Graph
Graph visualizer for JIRA tickets' dependencies
Stars: ✭ 194 (+13.45%)
Mutual labels:  graph-visualization
grasp
Essential NLP & ML, short & fast pure Python code
Stars: ✭ 58 (-66.08%)
Mutual labels:  graph-visualization
Ggraph
Graph visualization of big messy data
Stars: ✭ 771 (+350.88%)
Mutual labels:  graph-visualization
jungrapht-visualization
visualization and sample code from Java Universal Network Graph ported to use JGraphT models and algorithms
Stars: ✭ 37 (-78.36%)
Mutual labels:  graph-visualization
NetworkLayout.jl
Layout algorithms for graphs and trees in pure Julia.
Stars: ✭ 82 (-52.05%)
Mutual labels:  graph-visualization
Graph-Kit
📊 Android library for plotting and editing graphs 📈
Stars: ✭ 25 (-85.38%)
Mutual labels:  graph-visualization
Networkx
Network Analysis in Python
Stars: ✭ 10,057 (+5781.29%)
Mutual labels:  graph-visualization
Neo4j 3d Force Graph
Experiments with Neo4j & 3d-force-graph https://github.com/vasturiano/3d-force-graph
Stars: ✭ 159 (-7.02%)
Mutual labels:  graph-visualization
multigraph
multigraph: Plot and Manipulate Multigraphs in R
Stars: ✭ 18 (-89.47%)
Mutual labels:  graph-visualization
Graphtea
The Graph Theory Software
Stars: ✭ 69 (-59.65%)
Mutual labels:  graph-visualization
go-graph-layout
🔮 Graph Layout Algorithms in Go
Stars: ✭ 70 (-59.06%)
Mutual labels:  graph-visualization
Ggraph
Grammar of Graph Graphics
Stars: ✭ 815 (+376.61%)
Mutual labels:  graph-visualization
nodesoup
Force-directed graph layout with Fruchterman-Reingold
Stars: ✭ 40 (-76.61%)
Mutual labels:  graph-visualization
GeometricFlux.jl
Geometric Deep Learning for Flux
Stars: ✭ 288 (+68.42%)
Mutual labels:  juliagraphs
GraphIO.jl
Graph IO functionality for various formats.
Stars: ✭ 54 (-68.42%)
Mutual labels:  juliagraphs
StaticGraphs.jl
Memory-efficient immutable LightGraphs.
Stars: ✭ 33 (-80.7%)
Mutual labels:  juliagraphs

GraphPlot

CI version

Graph layout and visualization algorithms based on Compose.jl and inspired by GraphLayout.jl.

The spring_layout and stressmajorize_layout function are copy from IainNZ's GraphLayout.jl.

Other layout algorithms are wrapped from NetworkX.

gadfly.js is copied from Gadfly.jl

Getting Started

From the Julia REPL the latest version can be installed with

Pkg.add("GraphPlot")

GraphPlot is then loaded with

using GraphPlot

Usage

karate network

using Graphs: smallgraph
g = smallgraph(:karate)
gplot(g)

Add node label

using Graphs
nodelabel = 1:nv(g)
gplot(g, nodelabel=nodelabel)

Adjust node labels

gplot(g, nodelabel=nodelabel, nodelabeldist=1.5, nodelabelangleoffset=π/4)

Control the node size

# nodes size proportional to their degree
nodesize = [Graphs.outdegree(g, v) for v in Graphs.vertices(g)]
gplot(g, nodesize=nodesize)

Control the node color

Feed the keyword argument nodefillc a color array, ensure each node has a color. length(nodefillc) must be equal |V|.

using Colors

# Generate n maximally distinguishable colors in LCHab space.
nodefillc = distinguishable_colors(nv(g), colorant"blue")
gplot(g, nodefillc=nodefillc, nodelabel=nodelabel, nodelabeldist=1.8, nodelabelangleoffset=π/4)

Transparent

# stick out large degree nodes
alphas = nodesize/maximum(nodesize)
nodefillc = [RGBA(0.0,0.8,0.8,i) for i in alphas]
gplot(g, nodefillc=nodefillc)

Control the node label size

nodelabelsize = nodesize
gplot(g, nodelabelsize=nodelabelsize, nodesize=nodesize, nodelabel=nodelabel)

Draw edge labels

edgelabel = 1:Graphs.ne(g)
gplot(g, edgelabel=edgelabel, nodelabel=nodelabel)

Adjust edge labels

edgelabel = 1:Graphs.ne(g)
gplot(g, edgelabel=edgelabel, nodelabel=nodelabel, edgelabeldistx=0.5, edgelabeldisty=0.5)

Color the graph

# nodes membership
membership = [1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,2,1,1,2,1,2,1,2,2,2,2,2,2,2,2,2,2,2,2]
nodecolor = [colorant"lightseagreen", colorant"orange"]
# membership color
nodefillc = nodecolor[membership]
gplot(g, nodefillc=nodefillc)

Different layout

spring layout (default)

This is the defaut layout and will be chosen if no layout is specified. The default parameters to the spring layout algorithm can be changed by supplying an anonymous function, e.g., if nodes appear clustered too tightly together, try

layout=(args...)->spring_layout(args...; C=20)
gplot(g, layout=layout, nodelabel=nodelabel)

where C influences the desired distance between nodes.

random layout

gplot(g, layout=random_layout, nodelabel=nodelabel)

circular layout

gplot(g, layout=circular_layout, nodelabel=nodelabel)

spectral layout

gplot(g, layout=spectral_layout)

shell layout

nlist = Vector{Vector{Int}}(undef, 2) # two shells
nlist[1] = 1:5 # first shell
nlist[2] = 6:nv(g) # second shell
locs_x, locs_y = shell_layout(g, nlist)
gplot(g, locs_x, locs_y, nodelabel=nodelabel)

Curve edge

gplot(g, linetype="curve")

Save to figure

using Cairo, Compose
# save to pdf
draw(PDF("karate.pdf", 16cm, 16cm), gplot(g))
# save to png
draw(PNG("karate.png", 16cm, 16cm), gplot(g))
# save to svg
draw(SVG("karate.svg", 16cm, 16cm), gplot(g))

Graphs.jl integration

using Graphs
h = watts_strogatz(50, 6, 0.3)
gplot(h)

Arguments

  • G graph to plot
  • layout Optional. layout algorithm. Currently can choose from [random_layout, circular_layout, spring_layout, stressmajorize_layout, shell_layout, spectral_layout]. Default: spring_layout
  • nodelabel Optional. Labels for the vertices. Default: nothing
  • nodefillc Optional. Color to fill the nodes with. Default: colorant"turquoise"
  • nodestrokec Color for the node stroke. Default: nothing
  • arrowlengthfrac Fraction of line length to use for arrows. Set to 0 for no arrows. Default: 0 for undirected graph and 0.1 for directed graph
  • arrowangleoffset angular width in radians for the arrows. Default: π/9 (20 degrees)

Reporting Bugs

Filing an issue to report a bug, counterintuitive behavior, or even to request a feature is extremely valuable in helping me prioritize what to work on, so don't hestitate.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].