Created
December 3, 2019 15:41
-
-
Save cocomoff/0da9308bdb31ab9d50bf33e4ebe91ce4 to your computer and use it in GitHub Desktop.
Plots in Julia for graph visualizer (tentative)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 2 | |
1 3 | |
2 4 | |
3 4 | |
3 5 | |
4 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DelimitedFiles | |
using Plots | |
gr() | |
node_loc = readdlm("location.txt", Float64)[:, 2:end]; | |
edges = readdlm("edge.txt", Int); | |
@show node_loc; | |
@show edges; | |
plot(leg=false) | |
x = node_loc[:, 1] | |
y = node_loc[:, 2] | |
for row in 1:size(edges)[1] | |
f, t = edges[row, :] | |
locF = node_loc[f, :] | |
locT = node_loc[t, :] | |
xs = [locF[1], locT[1]] | |
ys = [locF[2], locT[2]] | |
println("$f -> $t") | |
plot!(xs, ys, color=:black, lw=3) | |
end | |
scatter!(x, y, color=:red, z = 2, ms=10) | |
savefig("out.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 1 2 | |
2 2 3 | |
3 3 5 | |
4 2 0 | |
5 1 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment