-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plots not displaying #144
Comments
This is, because GraphPlot does not have any code included to show a As an alternative you could:
|
@simonschoelly Thank you for your suggestions, I didn't find any other package or method that does what I want, but I think it is possible to call feh or imagemagick from julia and display an svg image in a new window ? |
Hi @simonschoelly Also, an equivalent for Maki-e would also be appreciated. |
I think that plotting |
Oh right. Yes I agree with you. Plots has such a beautiful support for so many different kinds of plots, and it's api is well known, so why not use that too? But I suppose it will involve some significant changes to code? I don't mean to challenge, just want to know why Compose was chosen instead of Plots 😊 |
I don't really know, as I was not involved at the time of the creation of this package. But there is a graph plotting library GraphRecipes.jl that uses Plots.jl as a backend. They kind of use the same layout algorithms as this package - I think they relay on NetworkLayou.jl, but that code was copy/pasted from GraphPlot.jl anyway - or maybe it happened in the other direction, I am not sure about that. |
Related issue to allow plotting Compose objects: GiovineItalia/Compose.jl#423 |
From the slack channel (written by Pavan Chaggar), you can make your network plots with Makie.jl. You could use the layout functions in GraphPlot.jl to get the coordinates for the nodes and then pass those over to Makie. using CairoMakie; CairoMakie.activate!()
using Graphs
A = [ #adjacency matrix
#x1 x2 x3 x4 f1 f2 f3
0 0 0 0 1 1 0 #x1
0 0 0 0 1 0 1 #x2
0 0 0 0 0 1 0 #x3
0 0 0 0 0 0 1 #x4
0 0 0 0 0 0 0 #f1
0 0 0 0 0 0 0 #f2
0 0 0 0 0 0 0 #f3
]
G = SimpleDiGraph(A)
f = Figure();
ax = Axis(f[1, 1], yreversed = true,
xautolimitmargin = (0.15, 0.20),
yautolimitmargin = (0.15, 0.20)
)
hidespines!(ax)
hidedecorations!(ax)
leftx, lefty = zeros(4), 1.:4.
rightx, righty = ones(3) * 3, range(1, 4, 3)
x = vcat(leftx, rightx)
y = vcat(lefty, righty)
points = Point.(zip(x, y))
cols = (:blue, :green, :purple)
parents = [inneighbors(G, i) for i in vertices(G)]
childs = findall(x -> length(x) > 0, parents)
function finputs(x)
str = "f("
for i in x[1:end-1]
str = str * "x_$i, "
end
str * "x_$(x[end]))"
end
for (i, v) in enumerate(childs)
for node in parents[v]
lines!(Point(x[[node, v]]...), Point(y[[node, v]]...),
color=cols[i], linewidth=5)
end
text!(points[v], text=L"%$(finputs(parents[v]))", offset=(20,-10))
end
for (i, point) in enumerate(points[1:4])
scatter!(point, color=:black, marker=:circle, markersize=25)
text!(point, text=L"x_%$i", offset=(-75, -10))
end
for (i, point) in enumerate(points[5:end])
scatter!(point, color=:black, marker=:rect, markersize=25)
end
f
save("fig.png", f) |
We can probably close this issue, unless anything else is going to be done on this end. |
There's GraphMakie.jl :) |
Hi,
gplot is not displaying the graph.
When I run the first example in the README I get the following errors:
Plots is working as expected and the plot is displayed in a new window
I am using julia v1.5.3 and a tiling window manager (i3).
Thanks,
Ahmat
The text was updated successfully, but these errors were encountered: