juliagraphs / graphplot.jl Goto Github PK
View Code? Open in Web Editor NEWGraph visualization for Julia.
Home Page: http://JuliaGraphs.github.io/GraphPlot.jl/
License: Other
Graph visualization for Julia.
Home Page: http://JuliaGraphs.github.io/GraphPlot.jl/
License: Other
Hi @afternone,
I just saw this code on julia-users. The visualizations look nice. I would like you to make clear that which code, including the spring and stress layout algorithms, have been copied directly from GraphLayouts.jl. In particular, you should adjust your license to make it clear that you do not own that code, and ideally the code would have comments indicating that it is not your work and where it came from.
Thanks!
Julia newbie here. I apologize if this is noise, but I've read through some of the other issues listed here, and it seems like they're addressing the actual usage of the package. I used pkg"add GraphPlot#master"
because I had errors when trying to install via Pkg.add, and that seemed to work. However, when I try to using GraphPlot
, I get this error message:
Info: Precompiling GraphPlot [a2cc645c-3eea-5389-862e-a155d0052231]
โ @ Base loading.jl:1186
ERROR: LoadError: LoadError: syntax: unsupported `const` declaration on local variable around /home/agirdhar/.julia/packages/GraphPlot/9WiLm/src/layout.jl:99
Stacktrace:
[1] include at ./boot.jl:317 [inlined]
[2] include_relative(::Module, ::String) at ./loading.jl:1038
[3] include at ./sysimg.jl:29 [inlined]
[4] include(::String) at /home/agirdhar/.julia/packages/GraphPlot/9WiLm/src/GraphPlot.jl:3
[5] top-level scope at none:0
[6] include at ./boot.jl:317 [inlined]
[7] include_relative(::Module, ::String) at ./loading.jl:1038
[8] include(::Module, ::String) at ./sysimg.jl:29
[9] top-level scope at none:2
[10] eval at ./boot.jl:319 [inlined]
[11] eval(::Expr) at ./client.jl:389
[12] top-level scope at ./none:3
in expression starting at /home/agirdhar/.julia/packages/GraphPlot/9WiLm/src/layout.jl:64
in expression starting at /home/agirdhar/.julia/packages/GraphPlot/9WiLm/src/GraphPlot.jl:23
Failed to precompile GraphPlot [a2cc645c-3eea-5389-862e-a155d0052231] to /home/agirdhar/.julia/compiled/v1.0/GraphPlot/bUwXr.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
[4] macro expansion at ./logging.jl:311 [inlined]
[5] _require(::Base.PkgId) at ./loading.jl:941
[6] require(::Base.PkgId) at ./loading.jl:852
[7] macro expansion at ./logging.jl:311 [inlined]
[8] require(::Module, ::Symbol) at ./loading.jl:834
[9] top-level scope at In[9]:25
I'm using Julia 1.0 in Jupyter with the most current version of LightGraphs. Any thoughts on this issue?
When I try to compile GraphPlot, I get the following error.
Is this the correct place to report this, and is there a simple way to resolve? I tried removing either LightGraphs or Graphs packages, but GraphPlot seems to depend on both so it seems like a catch-22.
Possibly this is just because I am using Julia v0.5 and I should be using Julia v0.6.
julia> using(GraphPlot)
INFO: Precompiling module GraphPlot.
WARNING: Method definition open_file(Any) in module GraphPlot at /home/.../.julia/v0.5/GraphPlot/src/plot.jl:229 overwritten at /home.../.julia/v0.5/GraphPlot/src/plot_test.jl:297.
WARNING: both Graphs and LightGraphs export "AbstractGraph"; uses of it in module GraphPlot must be qualified
ERROR: LoadError: UndefVarError: AbstractGraph not defined
I'm wondering if we set the plot layouts, e.g vertices color, edge color with MetaGraphs, and then we will be able to use a single command gplot(g)
to plot a graph.
But I didn't find any integration between these two packages, or there's some package I didn't notice?
Yay, issue #1!
Would you consider integrating this with LightGraphs? We have a couple of graph vis tools there now but we always welcome more.
Consider the following graph correctly displayed in a Jupyter notebook with display
:
When I try to save the graph to a file, the edges disappear:
draw(SVG("foo.svg", 16cm, 16cm), gplot(G))
There is an easy fix to this issue? I am preparing a presentation by the end of the week and I would like to include a GIF of the graph algorithm in action.
Could you please tag a new version? The latest tag is not functioning with the latest LG tag.
Hi,
Now that @juliohm has fixed some graphplot stuff, it works again in the REPL. If you have a mac and iterm with the iterm shell extensions installed, you can use graphcat
to display a graph in repl. This uses Plots, which gives a different view of the graph than GraphPlot.
If you have iterm with TerminalExtensions, gcat
will give you the GraphPlot view which (IMO) is a bit nicer. Screenshots attached.
You can download the code by cloning https://github.com/sbromberger/MiscGraphUtils.jl.
using LightGraphs
using GraphPlot
G = Graph(3)
gplot(G, layout=spectral_layout)
LoadError: MethodError:
_spectral
has no method matching _spectral(::SparseMatrixCSC{Int64,Int64})
while loading In[2], in expression starting on line 5
using LightGraphs
using GraphPlot
G = DiGraph(2)
add_edge!(G, 1,2)
add_edge!(G, 2,1)
display(gplot(G, linetype="curve"))
LoadError: MethodError:
convert
has no method matching convert(::Type{Measures.Measure}, ::Float64)
This may have arisen from a call to the constructor Measures.Measure(...),
since type constructors fall back to convert methods.
Closest candidates are:
call{T}(::Type{T}, ::Any)
convert{T}(::Type{T}, !Matched::T)
while loading In[50], in expression starting on line 8in call at /home/julio/.julia/v0.5/Compose/src/form.jl:894
in parsepathop at /home/julio/.julia/v0.5/Compose/src/form.jl:901
in parsepath at /home/julio/.julia/v0.5/Compose/src/form.jl:1098
in path at /home/julio/.julia/v0.5/Compose/src/form.jl:1125
in gplot#7 at /home/julio/.julia/v0.5/GraphPlot/src/plot.jl:191
in gplot at /home/julio/.julia/v0.5/GraphPlot/src/plot.jl:217
[inlined code] from essentials.jl:114
For some reason, some of the SVG generated by GraphPlot.jl are not appearing in the notebook online:
https://github.com/JuliaGraphs/JuliaGraphsTutorials/blob/master/Basics.ipynb
I am not sure this is an issue in the GraphPlot.jl package or an issue of the visualization feature of GitHub. The notebook shows correctly on my laptop locally.
@afternone do you have a guess of what may be happening? I don't want to interrupt you too much, I know you are about to defend your thesis.
Thanks for making a great package! Would it be possible to integrate this with the above two mentioned packages? I'm thinking that we then could write
gplot(g; layout=NetworkLayout:Stress)
where g is a weighted graph, which means that we directly use those weights as input to the NetworkLayout-algorithm?
Is it possible to adjust the colors of the edges? I don't see it anywhere in the examples. If not, could this be a feature? I have an application where I'd like to change the weight or transparency of the edges, and it seems like something that would be generally useful.
I get the following error with julia v0.6.1, GraphPlot 0.2.0 and Compose 0.5.4
julia> gplothtml(graphfamous("karate"))
WARNING: takebuf_string(b) is deprecated, use String(take!(b)) instead.
Stacktrace:
[1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
[2] takebuf_string(::Base.AbstractIOBuffer{Array{UInt8,1}}) at ./deprecated.jl:57
[3] #gplothtml#39(::GraphPlot.#spring_layout, ::Array{Any,1}, ::Function, ::LightGraphs.SimpleGraphs.SimpleGraph{Int64}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:248
[4] gplothtml(::LightGraphs.SimpleGraphs.SimpleGraph{Int64}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:242
[5] eval(::Module, ::Any) at ./boot.jl:235
[6] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
[7] macro expansion at ./REPL.jl:97 [inlined]
[8] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
ERROR: UndefVarError: OS_NAME not defined
Stacktrace:
[1] open_file(::String) at ~/.julia/v0.6/GraphPlot/src/plot.jl:229
[2] #gplothtml#39(::GraphPlot.#spring_layout, ::Array{Any,1}, ::Function, ::LightGraphs.SimpleGraphs.SimpleGraph{Int64}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:270
[3] gplothtml(::LightGraphs.SimpleGraphs.SimpleGraph{Int64}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:242
I can use Compose to draw an svg without problem.
julia> Compose.draw(Compose.SVG("dessin.svg", 20cm, 20cm), gplot(graphfamous("karate")))
false
=> svg created as expected
@afternone, could you please explain the file plot_test.jl
? Was it copied from plot.jl
with a few small changes? Can we get rid of it?
At the moment self-loops are simpy drawn as an arrow pointing to the vertex. As far as I know, such a self loop is usually drawn like this: https://en.wikipedia.org/wiki/Loop_(graph_theory)#/media/File:6n-graph2.svg
It the current implementation on purpose or could this be changed?
Inspired by a stackoverflow question.
It would be nice to allow the vertices' positions to be specified by, say, a vector of (x, y)
tuples, which are then normalized to whatever canvas is being used and plotted.
Can this package be registered and tagged with METADATA.jl such that one does not need to perform Pkg.clone
to make use of it?
Hi,
Nice package. In my current use case, I would like to use logos as nodes. I think someone else would want to use a picture of faces or similar. According to Compose.jl manual it is possible. Here is a simple example what I have in mind:
I can plot a graph fine using the built in graphs plot, but the gplot command fails with the following error
ERROR: LoadError: MethodError: _src_index
has no method matching _src_index(::Graphs.ExEdge{Graphs.ExVertex}, ::Graphs.GenericEdgeList{Graphs.ExVertex,Graphs.ExEdge{V},Array{Graphs.ExVertex,1},Array{Graphs.ExEdge{V},1}})
Closest candidates are:
_src_index{V}(::Graphs.Edge{V}, ::Graphs.AbstractGraph{V,E})
in graphline at /home/rachel/.julia/v0.4/GraphPlot/src/lines.jl:29
in gplot at /home/rachel/.julia/v0.4/GraphPlot/src/plot.jl:201
in gplot at /home/rachel/.julia/v0.4/GraphPlot/src/plot.jl:219
GraphPlot does not precompile properly on my computer (Windows 10 and Julia 0.6). It used to work with 0.5.2. Here is the error, it seems to be linked to the Graphs.jl dependency.
ERROR: LoadError: LoadError: TypeError: Type{...} expression: expected UnionAll, got base.Collections.#PriorityQueue
Stacktrace:
[1] include_from_node1(::String) at .\loading.jl:569
[2] include(::String) at .\sysimg.jl:14
[3] include_from_node1(::String) at .\loading.jl:569
[4] include(::String) at .\sysimg.jl:14
[5] anonymous at .\<missing>:2
while loading C:\Users\bouac\.julia\v0.6\Graphs\src\maximum_adjacency_visit.jl, in expression starting on line 15
while loading C:\Users\bouac\.julia\v0.6\Graphs\src\Graphs.jl, in expression starting on line 140
ERROR: LoadError: Failed to precompile Graphs to C:\Users\bouac\.julia\lib\v0.6\Graphs.ji.
Stacktrace:
[1] compilecache(::String) at .\loading.jl:703
[2] _require(::Symbol) at .\loading.jl:456
[3] require(::Symbol) at .\loading.jl:398
[4] include_from_node1(::String) at .\loading.jl:569
[5] include(::String) at .\sysimg.jl:14
[6] anonymous at .\<missing>:2
while loading C:\Users\bouac\.julia\v0.6\GraphPlot\src\GraphPlot.jl, in expression starting on line 7
ERROR: Failed to precompile GraphPlot to C:\Users\bouac\.julia\lib\v0.6\GraphPlot.ji.
Stacktrace:
[1] compilecache(::String) at .\loading.jl:703
[2] _require(::Symbol) at .\loading.jl:490
[3] require(::Symbol) at .\loading.jl:398
Thanks!
The following tutorial does not seem to work.
https://github.com/JuliaGraphs/GraphPlot.jl/blob/master/examples/graphplot.ipynb
I have executed the first two cells and I get the following errors.
julia> using Graphs, GraphPlot
Warning:[...]
julia> g = simple_graph(3, is_directed=false)
add_edge!(g, 1, 2)
add_edge!(g, 2, 3)
add_edge!(g, 3, 1)
# just plot it
gplot(g)
Undirected Graph (3 vertices, 0 edges)
julia> edge [1]: 1 -- 2
julia> edge [2]: 2 -- 3
julia> edge [3]: 3 -- 1
julia>
julia> ERROR: MethodError: no method matching _nv(::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}})
Closest candidates are:
_nv(!Matched::LightGraphs.AbstractGraph) at ~/.julia/v0.6/GraphPlot/src/GraphPlot.jl:41
Stacktrace:
[1] spring_layout(::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}}) at ~/.julia/v0.6/GraphPlot/src/layout.jl:99
[2] #gplot#38(::GraphPlot.#spring_layout, ::Array{Any,1}, ::Function, ::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:224
[3] gplot(::Graphs.GenericGraph{Int64,Graphs.Edge{Int64},UnitRange{Int64},Array{Graphs.Edge{Int64},1},Array{Array{Graphs.Edge{Int64},1},1}}) at ~/.julia/v0.6/GraphPlot/src/plot.jl:224
There are large parts of the code that are not covered by tests. Furthermore, there should be tests special cases, such as graphs with 0, 1, 2 or three vertices, few edges, self-loops and so on as some of the layouts have problems with these cases.
I would like to create a figure with several graphs. Does GraphPlot support anything like subplot?
The documentation for spring_layout
says, that the algorithm uses the the forces
Attractive force: f_a(d) = d^2 / k
Repulsive force: f_r(d) = -k^2 / d
but what it actually does, is using
Attractive force: f_a(d) = d / k
Repulsive force: f_r(d) = -k^2 / d^2
where d
is the distance between two vertices and k
is some constant. That also works, so I'm wondering, if we want to keep using this modified version or use the original version by Fruchterman and Reingold.
Networkx uses the same modified version, so either this is done on purpose or the error was copied when implementing it in Julia.
I don't think a plotting package is the right place for this
https://github.com/JuliaGraphs/GraphPlot.jl/blob/master/src/graphio.jl
Maybe move it to LighGraphs? @sbromberger @afternone
Both the functions graphfamous
and readedgelist
should be removed
I'd like to use #76 (deterministic spring layout) without telling my colleagues to install GraphPlots#master
. That was the last change in almost four months, so I'd really appreciate a minor release.
Thanks for all your hard work!
This commit modified the placement of edge labels for directed graphs such that the edge label location cannot be altered by the end user. Can this change be reverted such as to allow for the placement of edge labels to still be controlled by the edgelabeldistx
and edgelabeldisty
arguments?
Can we remove plot_test.jl
from the project? It seems that it was copied from plot.jl
and slightly modified for...?
Please let me know if I can proceed and I will submit a PR with the deletion.
Hi, I'm using the GraphPlot package in my Julia program. I added that to Julia and even updated it several times.I checked whether the required GraphPlot.ji is in /Users/user/.julia/lib/v0.5. But it's located in the following path. /Users/user/.julia/v0.5/GraphPlot/src.
LoadError: Failed to precompile GraphPlot to /Users/user/.julia/lib/v0.5/GraphPlot.ji. while loading /Users/user/Dropbox/P/M/ip.jl, in expression starting on line 5 in compilecache(::String) at loading.jl:593 in require(::Symbol) at loading.jl:422 in require(::Symbol) at sys.dylib:? in include_string(::String, ::String) at loading.jl:441 in include_string(::String, ::String) at sys.dylib:? in include_string(::Module, ::String, ::String) at eval.jl:34 in (::Atom.##59#62{String,String})() at eval.jl:73 in withpath(::Atom.##59#62{String,String}, ::String) at utils.jl:30 in withpath(::Function, ::String) at eval.jl:38 in macro expansion at eval.jl:71 [inlined] in (::Atom.##58#61{Dict{String,Any}})() at task.jl:60
It seems strange to REQUIRE LightGraphs and Graphs when in all likelihood people will want to use this great package for either one or the other. Could I recommend something along the lines of what we do in LightGraphs for conditional dependencies?
try
using LightGraphs
nothing
catch
end
then you can have
if isdefined(:LightGraphs)
...
for the LG specific code, repeating for Graphs.jl as necessary.
I'd like to add Erdos support to GraphPlot. The implementation is kinda trivial but there is a design decision I would like to discuss with @afternone @jpfairbanks @sbromberger before I file a PR.
Up to few days ago, when both Graphs and LightGraphs where supported, they where both required and imported by GraphPlot. We could do the same with Erdos and LG, also dependencywise it wouldn't be a burden since most dependence are in common, but I think that a cleaner design for GraphPlot would be to have it depend on no package:
try
import LightGraphs
catch
println("LightGraphs not installed. Once installed, execute the command `Base.compilecache(\"GraphPlot\")`
to activate plotting functionalities for LightGraphs.")
end
try
import Erdos
catch
println("Erdos not installed. Once installed, execute the command `Base.compilecache(\"GraphPlot\")`
to activate plotting functionalities for Erdos.")
end
if !isdefined(:Erdos) && !isdefined(:LightGraphs)
warn("No supported graph package installed.")
end
if isdefined(:LightGraphs)
_nv(g::LightGraphs.SimpleGraph) = LightGraphs.nv(g)
_ne(g::LightGraphs.SimpleGraph) = LightGraphs.ne(g)
_vertices(g::LightGraphs.SimpleGraph) = LightGraphs.vertices(g)
_edges(g::LightGraphs.SimpleGraph) = LightGraphs.edges(g)
_src_index(e::LightGraphs.Edge, g::LightGraphs.SimpleGraph) = LightGraphs.src(e)
_dst_index(e::LightGraphs.Edge, g::LightGraphs.SimpleGraph) = LightGraphs.dst(e)
_adjacency_matrix(g::LightGraphs.SimpleGraph) = LightGraphs.adjacency_matrix(g)
_is_directed(g::LightGraphs.SimpleGraph) = LightGraphs.is_directed(g)
_laplacian_matrix(g::LightGraphs.SimpleGraph) = LightGraphs.laplacian_matrix(g)
end
....
What do you think?
Hi (and thanks for the fantastic package!)
When using
using Colors
using GraphPlot
g = graphfamous("karate")
gplothtml(g,nodestrokec = RGB(1,0,0))
nodes remain as in case when I skip the nodestrokec argument. Am I misunderstanding something or is it a bug?
EDIT: nevermind; just figured out that nodestroke linewidth is 0 buy default, sorry for creating an issue!
Make GraphPlot usable from julia & LightGraphs 1.0
FactCheck is not actively mantained (it is in the JuliaArchive org)
Graphs.jl itself is now part of JuliaArchive, and it's a fairly heavy dependency. I'd like to propose that we tag a final version that has Graphs.jl compatibility and then remove it from REQUIRE
.
Thoughts?
It looks like the signature for gplot
indicates that the x_loc_in
and y_loc_in
arguments can be any subtype of Real
, but when I input integer arrays for those arguments, an InexactError()
is thrown:
grid = Grid([4, 8])
xloc = repeat(collect(1:8); inner = 4)
yloc = repeat(collect(1:4); outer = 8)
gplot(grid, xloc, yloc)
ERROR: InexactError()
Stacktrace:
[1] convert(::Type{Int64}, ::Float64) at ./float.jl:679
[2] map!(::GraphPlot.##29#34, ::Array{Int64,1}, ::Array{Int64,1}) at ./abstractarray.jl:1862
[3] #gplot#28(::Void, ::ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}}, ::Float64, ::Float64, ::Float64, ::Float64, ::Array{Any,1}, ::ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}}, ::Float64, ::Float64, ::ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}}, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}}, ::Void, ::Float64, ::Float64, ::Float64, ::String, ::Float64, ::GraphPlot.#gplot, ::LightGraphs.SimpleGraphs.SimpleGraph{Int64}, ::Array{Int64,1}, ::Array{Int64,1}) at /home/cbieganek/.julia/v0.6/GraphPlot/src/plot.jl:134
[4] gplot(::LightGraphs.SimpleGraphs.SimpleGraph{Int64}, ::Array{Int64,1}, ::Array{Int64,1}) at /home/cbieganek/.julia/v0.6/GraphPlot/src/plot.jl:115
It works fine if I input arrays of floats instead:
gplot(grid, Float64.(xloc), Float64.(yloc))
Could you please fix this issue?
LoadError: UndefVarError: _src not defined
while loading In[10], in expression starting on line 5in spectral_layout at /home/juliohm/.julia/v0.4/GraphPlot/src/layout.jl:238
in gplot at /home/juliohm/.julia/v0.4/GraphPlot/src/plot.jl:219
I'm attaching some files that show the result of rendering with GraphPlot (gets it wrong) and with TikzGraph (gets it right).
The data are here: https://drive.google.com/file/d/12CfjV7kv2r7EAmSQoudfMog7p9r-OAr1/view?usp=sharing
Save that to /tmp/backedges.jld2
or something similar. Then you can create the graph with
julia> using FileIO
julia> backedges = load("/tmp/backedges.jld2", "backedges");
julia> using LightGraphs
julia> g = SimpleDiGraph(length(backedges))
{652, 0} directed simple Int64 graph
julia> for (i, deps) in enumerate(backedges)
for src in deps
add_edge!(g, src, i)
end
end
and then plot g
.
With GraphPlot you can see the edges don't connect to nodes on both ends.
The default spring_layout
is non-deterministic, which doesn't seem desirable to me. It seems better to do something like:
function deterministic_spring_layout(g::AbstractGraph; seed::Integer=0, kws...)
rng = MersenneTwister(seed)
spring_layout(g, 2 .* rand(rng, nv(g)) .- 1.0, 2 .* rand(rng,nv(g)) .- 1.0; kws...)
end
I'm looking at a version of the connectome("neural wiring") of the C. elegans worm, a graph of 297 vertices. I'm trying to display the graph with each vertex colored according to it's eccentricity, with more central vertices in a hotter color.
However, gplot()
colors each node black, even with the nodefillc
parameter assigned. It seems that this is an issue with plotting large graphs. Test code, adapted from the documentation:
using LightGraphs
using GraphPlot
n=195
g=erdos_renyi(n,.05)
membership=rand([1,2], nv(g));
nodecolor = [colorant"lightseagreen", colorant"orange"]
nodefillc = nodecolor[membership]
gplot(g, nodefillc=nodefillc)
When n
is larger than 195, the nodes are all filled in black, as opposed to green and orange.
This package is not currently compatible with 1.0 and 0.7
using LightGraphs
using GraphPlot
h = DiGraph(5)
add_edge!(h,1,2)
add_edge!(h,1,4)
gplot(h)
LoadError: MethodError: `_nv` has no method matching _nv(::LightGraphs.DiGraph)
while loading In[6], in expression starting on line 1
in spring_layout at /home/ollin/.julia/v0.4/GraphPlot/src/layout.jl:99
in gplot at /home/ollin/.julia/v0.4/GraphPlot/src/plot.jl:224
Hi,
I am very new to Julia and its packages. I just tried to plot the following simple example. But instead of returning a plot, I actually receive only text (when executing in the terminal; however, it is plotting just fine when running in an IJulia notebook):
julia> using LightGraphs
julia> using GraphPlot
julia> g = Graph(10)
{10, 0} undirected simple Int64 graph
julia> add_edge!(g,1,2)
true
julia> add_edge!(g,1,3)
true
julia> add_edge!(g,2,4)
true
julia> gplot(g)
Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(Compose.UnitBox{Float64,Float64,Float64,Float64}(-1.2, -1.2, 2.4, 2.4, 0.0mm, 0.0mm, 0.0mm, 0.0mm)), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([Compose.Form{Compose.LinePrimitive}(Compose.LinePrimitive[Compose.LinePrimitive{Tuple{Measures.Measure,Measures.Measure}}(Tuple{Measures.Measure,Measures.Measure}[(0.450282cx, -0.154949cy), (0.42973cx, -0.145017cy)]), Compose.LinePrimitive{Tuple{Measures.Measure,Measures.Measure}}(Tuple{Measures.Measure,Measures.Measure}[(0.592226cx, -0.224599cy), (0.599174cx, -0.22806cy)]), Compose.LinePrimitive{Tuple{Measures.Measure,Measures.Measure}}(Tuple{Measures.Measure,Measures.Measure}[(0.287127cx, -0.0767231cy), (0.283029cx, -0.0747783cy)])], Symbol(""))]), List([Compose.Property{Compose.LineWidthPrimitive}(Compose.LineWidthPrimitive[Compose.LineWidthPrimitive(0.948683mm)]), Compose.Property{Compose.FillPrimitive}(Compose.FillPrimitive[Compose.FillPrimitive(RGBA{Float64}(0.0,0.0,0.0,0.0))]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.827451,0.827451,0.827451,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol("")), Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([]), List([Compose.Property{Compose.LineWidthPrimitive}(Compose.LineWidthPrimitive[Compose.LineWidthPrimitive(0.948683mm)]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.827451,0.827451,0.827451,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol("")), Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([]), List([Compose.Property{Compose.FontSizePrimitive}(Compose.FontSizePrimitive[Compose.FontSizePrimitive(4.0mm)]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.0,0.0,0.0,0.0))]), Compose.Property{Compose.FillPrimitive}(Compose.FillPrimitive[Compose.FillPrimitive(RGBA{Float64}(0.0,0.0,0.0,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol("")), Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([Compose.Form{Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}}(Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}[Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.521462cx, -0.18935cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.35855cx, -0.110616cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.669937cx, -0.263309cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.211605cx, -0.0408853cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((1.0cx, 0.842752cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((-1.0cx, 0.0422872cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.513202cx, 0.981626cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((-0.720904cx, -0.747201cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((-0.311552cx, 1.0cy), 0.0316228w), Compose.CirclePrimitive{Tuple{Measures.Measure,Measures.Measure},Measures.Measure}((0.0961543cx, -1.0cy), 0.0316228w)], Symbol(""))]), List([Compose.Property{Compose.LineWidthPrimitive}(Compose.LineWidthPrimitive[Compose.LineWidthPrimitive(0.0mm)]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.0,0.0,0.0,0.0))]), Compose.Property{Compose.FillPrimitive}(Compose.FillPrimitive[Compose.FillPrimitive(RGBA{Float64}(0.25098,0.878431,0.815686,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol("")), Compose.Context(Measures.BoundingBox{Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}},Tuple{Measures.Length{:w,Float64},Measures.Length{:h,Float64}}}((0.0w, 0.0h), (1.0w, 1.0h)), Nullable{Compose.UnitBox}(), Nullable{Compose.Rotation}(), Nullable{Compose.Mirror}(), List([]), List([]), List([Compose.Property{Compose.FontSizePrimitive}(Compose.FontSizePrimitive[Compose.FontSizePrimitive(4.0mm)]), Compose.Property{Compose.StrokePrimitive}(Compose.StrokePrimitive[Compose.StrokePrimitive(RGBA{Float64}(0.0,0.0,0.0,0.0))]), Compose.Property{Compose.FillPrimitive}(Compose.FillPrimitive[Compose.FillPrimitive(RGBA{Float64}(0.0,0.0,0.0,1.0))])]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol(""))]), List([]), List([]), 0, false, false, false, false, nothing, nothing, 0.0, Symbol(""))
julia>
I am sure I am doing something wrong. I just cannot figure out what it is. I googled the issue but I couldn't find a similar issue.
Many thanks for your help and feedback!
Marco
It would be nice if the node size automatically stretched out to fit the label text. (Also, currently you can only change the node radius, but for this you would want to stretch the node elliptically in one direction.)
For example, consider the following labelled graph:
and compare to the output of GraphViz for similar labels:
(Note also that GraphViz has proper arrowheads.)
Hi,
I want to use GraphPlot to visualize my graphs from LightGraphs.
By using GraphPlot i have got the following error in the Precompiling state.
Can you help me ?
ERROR:
julia> using GraphPlot
INFO: Precompiling module GraphPlot.
WARNING: Method definition open_file(Any) in module GraphPlot at /home/simon/.julia/v0.5/GraphPlot/src/plot.jl:229 overwritten at /home/simon/.julia/v0.5/GraphPlot/src/plot_test.jl:297.
WARNING: both Graphs and LightGraphs export "AbstractGraph"; uses of it in module GraphPlot must be qualified
ERROR: LoadError: UndefVarError: AbstractGraph not defined
in macro expansion; at ./none:2 [inlined]
in anonymous at ./:?
while loading /home/simon/.julia/v0.5/GraphPlot/src/GraphPlot.jl, in expression starting on line 56
ERROR: Failed to precompile GraphPlot to /home/simon/.julia/lib/v0.5/GraphPlot.ji.
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
in macro expansion at ./REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68
Julia Version
Version 0.5.1
Installed Packages:
julia> Pkg.status()
14 required packages:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.