diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cd7edbe4..ffaca8a1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,8 +13,9 @@ jobs: fail-fast: false matrix: version: - - '1.6' - - '1' + - 'lts' # long-term support release + - '1' # latest stable 1.x release + - 'pre' # latest stable prerelease os: - ubuntu-latest arch: diff --git a/Project.toml b/Project.toml index 4f6ddd9d..df9dbf6c 100644 --- a/Project.toml +++ b/Project.toml @@ -19,9 +19,10 @@ DataStructures = "0.17, 0.18" GeometryBasics = "0.4" Graphs = "1.4" Makie = "0.21" -NetworkLayout = "0.4.3" +NetworkLayout = "0.4.7" PolynomialRoots = "1" SimpleTraits = "0.9" +StableRNGs = "1.0.2" StaticArrays = "1.2" julia = "1" @@ -30,7 +31,8 @@ CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf" +StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["CairoMakie", "FileIO", "Literate", "ReferenceTests", "Test"] +test = ["CairoMakie", "FileIO", "Literate", "ReferenceTests", "StableRNGs", "Test"] diff --git a/assets/interactions.jl-01.png b/assets/interactions.jl-01.png index f1339690..c3e133b7 100644 Binary files a/assets/interactions.jl-01.png and b/assets/interactions.jl-01.png differ diff --git a/assets/interactions.jl-02.png b/assets/interactions.jl-02.png index 707e9e04..c7f2b636 100644 Binary files a/assets/interactions.jl-02.png and b/assets/interactions.jl-02.png differ diff --git a/assets/interactions.jl-03.png b/assets/interactions.jl-03.png index 70c615bd..ce36c93f 100644 Binary files a/assets/interactions.jl-03.png and b/assets/interactions.jl-03.png differ diff --git a/assets/interactions.jl-04.png b/assets/interactions.jl-04.png index 418245ad..51ea98e8 100644 Binary files a/assets/interactions.jl-04.png and b/assets/interactions.jl-04.png differ diff --git a/assets/interactions.jl-05.png b/assets/interactions.jl-05.png index 342adb96..550d85a7 100644 Binary files a/assets/interactions.jl-05.png and b/assets/interactions.jl-05.png differ diff --git a/assets/interactions.jl-06.png b/assets/interactions.jl-06.png index 8f6e5a67..3a92d643 100644 Binary files a/assets/interactions.jl-06.png and b/assets/interactions.jl-06.png differ diff --git a/assets/plots.jl-01.png b/assets/plots.jl-01.png index f44df3ae..55bd106a 100644 Binary files a/assets/plots.jl-01.png and b/assets/plots.jl-01.png differ diff --git a/assets/plots.jl-02.png b/assets/plots.jl-02.png index 6951cfb7..fff0f24e 100644 Binary files a/assets/plots.jl-02.png and b/assets/plots.jl-02.png differ diff --git a/assets/plots.jl-03.png b/assets/plots.jl-03.png index 6b4553ff..2bfe99d9 100644 Binary files a/assets/plots.jl-03.png and b/assets/plots.jl-03.png differ diff --git a/assets/plots.jl-04.png b/assets/plots.jl-04.png index 379fe8b6..cc33dd85 100644 Binary files a/assets/plots.jl-04.png and b/assets/plots.jl-04.png differ diff --git a/assets/plots.jl-05.png b/assets/plots.jl-05.png index fee935e7..de25619b 100644 Binary files a/assets/plots.jl-05.png and b/assets/plots.jl-05.png differ diff --git a/assets/plots.jl-06.png b/assets/plots.jl-06.png index ae0aba9b..0d8efabc 100644 Binary files a/assets/plots.jl-06.png and b/assets/plots.jl-06.png differ diff --git a/assets/plots.jl-07.png b/assets/plots.jl-07.png index bb167a8c..5424ccd9 100644 Binary files a/assets/plots.jl-07.png and b/assets/plots.jl-07.png differ diff --git a/assets/plots.jl-08.png b/assets/plots.jl-08.png index 4ae903e9..f7d6c579 100644 Binary files a/assets/plots.jl-08.png and b/assets/plots.jl-08.png differ diff --git a/assets/plots.jl-09.png b/assets/plots.jl-09.png index 64eb5c72..9efc51d2 100644 Binary files a/assets/plots.jl-09.png and b/assets/plots.jl-09.png differ diff --git a/assets/plots.jl-10.png b/assets/plots.jl-10.png index 1175fff8..f3741918 100644 Binary files a/assets/plots.jl-10.png and b/assets/plots.jl-10.png differ diff --git a/assets/plots.jl-11.png b/assets/plots.jl-11.png index a1e8c008..5784c385 100644 Binary files a/assets/plots.jl-11.png and b/assets/plots.jl-11.png differ diff --git a/assets/plots.jl-12.png b/assets/plots.jl-12.png index b08be117..10a83c83 100644 Binary files a/assets/plots.jl-12.png and b/assets/plots.jl-12.png differ diff --git a/assets/plots.jl-13.png b/assets/plots.jl-13.png index bf670398..d5d407c0 100644 Binary files a/assets/plots.jl-13.png and b/assets/plots.jl-13.png differ diff --git a/assets/plots.jl-14.png b/assets/plots.jl-14.png index 18ae2124..6d2de282 100644 Binary files a/assets/plots.jl-14.png and b/assets/plots.jl-14.png differ diff --git a/assets/plots.jl-17.png b/assets/plots.jl-17.png index 810eb73f..ba1612fb 100644 Binary files a/assets/plots.jl-17.png and b/assets/plots.jl-17.png differ diff --git a/assets/reftests.jl-01.png b/assets/reftests.jl-01.png index d6bc7a8b..d199667d 100644 Binary files a/assets/reftests.jl-01.png and b/assets/reftests.jl-01.png differ diff --git a/assets/reftests.jl-02.png b/assets/reftests.jl-02.png index b4c4b24e..7fcc2573 100644 Binary files a/assets/reftests.jl-02.png and b/assets/reftests.jl-02.png differ diff --git a/assets/reftests.jl-03.png b/assets/reftests.jl-03.png index 0e932471..17f4a236 100644 Binary files a/assets/reftests.jl-03.png and b/assets/reftests.jl-03.png differ diff --git a/assets/reftests.jl-04.png b/assets/reftests.jl-04.png index 0bff2a65..5746c9e4 100644 Binary files a/assets/reftests.jl-04.png and b/assets/reftests.jl-04.png differ diff --git a/assets/reftests.jl-05.png b/assets/reftests.jl-05.png index 62f76881..5ecdb23e 100644 Binary files a/assets/reftests.jl-05.png and b/assets/reftests.jl-05.png differ diff --git a/assets/reftests.jl-06.png b/assets/reftests.jl-06.png index 040ce87f..0c94e396 100644 Binary files a/assets/reftests.jl-06.png and b/assets/reftests.jl-06.png differ diff --git a/assets/reftests.jl-07.png b/assets/reftests.jl-07.png index 791980e1..6c6904d0 100644 Binary files a/assets/reftests.jl-07.png and b/assets/reftests.jl-07.png differ diff --git a/assets/reftests.jl-08.png b/assets/reftests.jl-08.png index 4abbe905..f216fd43 100644 Binary files a/assets/reftests.jl-08.png and b/assets/reftests.jl-08.png differ diff --git a/assets/reftests.jl-09.png b/assets/reftests.jl-09.png index ef964996..75caa5ae 100644 Binary files a/assets/reftests.jl-09.png and b/assets/reftests.jl-09.png differ diff --git a/assets/reftests.jl-10.png b/assets/reftests.jl-10.png index 518ce973..dea45f06 100644 Binary files a/assets/reftests.jl-10.png and b/assets/reftests.jl-10.png differ diff --git a/assets/reftests.jl-11.png b/assets/reftests.jl-11.png index f2636a91..cdf31e8f 100644 Binary files a/assets/reftests.jl-11.png and b/assets/reftests.jl-11.png differ diff --git a/assets/reftests.jl-12.png b/assets/reftests.jl-12.png index 320d3664..b2c27056 100644 Binary files a/assets/reftests.jl-12.png and b/assets/reftests.jl-12.png differ diff --git a/assets/reftests.jl-13.png b/assets/reftests.jl-13.png index ff4ab802..cf3e3897 100644 Binary files a/assets/reftests.jl-13.png and b/assets/reftests.jl-13.png differ diff --git a/assets/reftests.jl-14.png b/assets/reftests.jl-14.png index 302491a5..d764a7c3 100644 Binary files a/assets/reftests.jl-14.png and b/assets/reftests.jl-14.png differ diff --git a/assets/reftests.jl-15.png b/assets/reftests.jl-15.png index f303d3e7..0f3aa69e 100644 Binary files a/assets/reftests.jl-15.png and b/assets/reftests.jl-15.png differ diff --git a/assets/reftests.jl-16.png b/assets/reftests.jl-16.png index 2c455331..3ea6f66e 100644 Binary files a/assets/reftests.jl-16.png and b/assets/reftests.jl-16.png differ diff --git a/assets/reftests.jl-17.png b/assets/reftests.jl-17.png index 88c7ddd8..69aac5e3 100644 Binary files a/assets/reftests.jl-17.png and b/assets/reftests.jl-17.png differ diff --git a/assets/reftests.jl-18.png b/assets/reftests.jl-18.png index 7f5ae8b7..5fed34b6 100644 Binary files a/assets/reftests.jl-18.png and b/assets/reftests.jl-18.png differ diff --git a/assets/reftests.jl-19.png b/assets/reftests.jl-19.png index 4e41b369..9f757b8d 100644 Binary files a/assets/reftests.jl-19.png and b/assets/reftests.jl-19.png differ diff --git a/assets/reftests.jl-20.png b/assets/reftests.jl-20.png index f316eeb1..caef907f 100644 Binary files a/assets/reftests.jl-20.png and b/assets/reftests.jl-20.png differ diff --git a/assets/reftests.jl-21.png b/assets/reftests.jl-21.png index d3642488..a0d59b9e 100644 Binary files a/assets/reftests.jl-21.png and b/assets/reftests.jl-21.png differ diff --git a/assets/reftests.jl-22.png b/assets/reftests.jl-22.png index 49e5355e..cb05f198 100644 Binary files a/assets/reftests.jl-22.png and b/assets/reftests.jl-22.png differ diff --git a/assets/reftests.jl-23.png b/assets/reftests.jl-23.png index 8944b4e1..d2eb6330 100644 Binary files a/assets/reftests.jl-23.png and b/assets/reftests.jl-23.png differ diff --git a/assets/reftests.jl-24.png b/assets/reftests.jl-24.png index 405e1232..32beca5d 100644 Binary files a/assets/reftests.jl-24.png and b/assets/reftests.jl-24.png differ diff --git a/assets/reftests.jl-25.png b/assets/reftests.jl-25.png index e246f984..41aee522 100644 Binary files a/assets/reftests.jl-25.png and b/assets/reftests.jl-25.png differ diff --git a/assets/reftests.jl-26.png b/assets/reftests.jl-26.png index 94b95d8c..1757a4a6 100644 Binary files a/assets/reftests.jl-26.png and b/assets/reftests.jl-26.png differ diff --git a/assets/reftests.jl-27.png b/assets/reftests.jl-27.png index 5a026698..2bf4b14e 100644 Binary files a/assets/reftests.jl-27.png and b/assets/reftests.jl-27.png differ diff --git a/assets/reftests.jl-28.png b/assets/reftests.jl-28.png index 85e5d0a2..1c9efdc5 100644 Binary files a/assets/reftests.jl-28.png and b/assets/reftests.jl-28.png differ diff --git a/assets/reftests.jl-29.png b/assets/reftests.jl-29.png index 33991257..036a45cb 100644 Binary files a/assets/reftests.jl-29.png and b/assets/reftests.jl-29.png differ diff --git a/assets/reftests.jl-30.png b/assets/reftests.jl-30.png index aab9ec53..770f11c2 100644 Binary files a/assets/reftests.jl-30.png and b/assets/reftests.jl-30.png differ diff --git a/assets/reftests.jl-31.png b/assets/reftests.jl-31.png index c29ed655..f84cf633 100644 Binary files a/assets/reftests.jl-31.png and b/assets/reftests.jl-31.png differ diff --git a/assets/reftests.jl-32.png b/assets/reftests.jl-32.png index d57db2d2..432186af 100644 Binary files a/assets/reftests.jl-32.png and b/assets/reftests.jl-32.png differ diff --git a/assets/reftests.jl-33.png b/assets/reftests.jl-33.png index 7e7d7e02..6e1839ed 100644 Binary files a/assets/reftests.jl-33.png and b/assets/reftests.jl-33.png differ diff --git a/assets/reftests.jl-34.png b/assets/reftests.jl-34.png index 7e35adab..d7fe9ee0 100644 Binary files a/assets/reftests.jl-34.png and b/assets/reftests.jl-34.png differ diff --git a/assets/reftests.jl-35.png b/assets/reftests.jl-35.png index 51ae9971..96167edd 100644 Binary files a/assets/reftests.jl-35.png and b/assets/reftests.jl-35.png differ diff --git a/assets/reftests.jl-36.png b/assets/reftests.jl-36.png index 8223bfd6..839669d4 100644 Binary files a/assets/reftests.jl-36.png and b/assets/reftests.jl-36.png differ diff --git a/assets/reftests.jl-37.png b/assets/reftests.jl-37.png index 18fc0aad..90c6fbe1 100644 Binary files a/assets/reftests.jl-37.png and b/assets/reftests.jl-37.png differ diff --git a/assets/reftests.jl-38.png b/assets/reftests.jl-38.png index 18fc0aad..90c6fbe1 100644 Binary files a/assets/reftests.jl-38.png and b/assets/reftests.jl-38.png differ diff --git a/assets/reftests.jl-39.png b/assets/reftests.jl-39.png index 9a6ceeec..22500ef5 100644 Binary files a/assets/reftests.jl-39.png and b/assets/reftests.jl-39.png differ diff --git a/assets/reftests.jl-40.png b/assets/reftests.jl-40.png index 0d73bc2d..fd40496c 100644 Binary files a/assets/reftests.jl-40.png and b/assets/reftests.jl-40.png differ diff --git a/assets/reftests.jl-41.png b/assets/reftests.jl-41.png index 667387b5..f19ef981 100644 Binary files a/assets/reftests.jl-41.png and b/assets/reftests.jl-41.png differ diff --git a/assets/reftests.jl-42.png b/assets/reftests.jl-42.png index e9b35447..50847698 100644 Binary files a/assets/reftests.jl-42.png and b/assets/reftests.jl-42.png differ diff --git a/assets/reftests.jl-43.png b/assets/reftests.jl-43.png index b7ead8a4..e629de87 100644 Binary files a/assets/reftests.jl-43.png and b/assets/reftests.jl-43.png differ diff --git a/docs/Project.toml b/docs/Project.toml index 0b9b68d9..7698e1d7 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,3 +1,5 @@ +name = "GraphMakie docs" + [deps] CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76" @@ -15,6 +17,7 @@ NetworkDynamics = "22e9dc34-2a0d-11e9-0de0-8588d035468b" NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" RegistryInstances = "2792f1a3-b283-48e8-9a74-f99dce5104f3" +StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008" [compat] @@ -31,7 +34,7 @@ Literate = "2" MLJ = "0.20" Makie = "0.21" NetworkDynamics = "0.8.3" -NetworkLayout = "0.4" +NetworkLayout = "0.4.7" OrdinaryDiffEq = "6" RegistryInstances = "0.1" WGLMakie = "0.10" diff --git a/docs/examples/plots.jl b/docs/examples/plots.jl index daec893b..30cd1cf9 100644 --- a/docs/examples/plots.jl +++ b/docs/examples/plots.jl @@ -9,6 +9,7 @@ CairoMakie.activate!(type="png") # hide set_theme!(size=(800, 400)) #hide using GraphMakie using Graphs +using StableRNGs g = wheel_graph(10) f, ax, p = graphplot(g) @@ -82,7 +83,7 @@ hidedecorations!(ax); hidespines!(ax); ax.aspect = DataAspect() # This is not very nice, lets change the offsets based on the `node_positions` offsets = 0.15 * (p[:node_pos][] .- p[:node_pos][][1]) -offsets[1] = Point2f(0, 0.3) +offsets[1] = Point2f(0.1, 0.3) p.nlabels_offset[] = offsets autolimits!(ax) @save_reference f #hide @@ -98,10 +99,10 @@ f, ax, p = graphplot(g; xlims!(ax, (-1.5, 1.3)) ylims!(ax, (-2.3, 0.7)) hidedecorations!(ax); hidespines!(ax); ax.aspect = DataAspect() -f #hide +@save_reference f #hide # ## Adding Edge Labels -g = barabasi_albert(6, 2; seed=42) +g = barabasi_albert(6, 2; rng=StableRNGs.StableRNG(1)) labels = repr.(1:ne(g)) @@ -109,7 +110,7 @@ f, ax, p = graphplot(g, elabels=labels, elabels_color=[:black for i in 1:ne(g)], edge_color=[:black for i in 1:ne(g)]) hidedecorations!(ax); hidespines!(ax); ax.aspect = DataAspect() -@save_reference f #hide +f #hide #= The position of the edge labels is determined by several plot arguments. @@ -118,7 +119,7 @@ All possible arguments are described in the docs of the [`graphplot`](@ref) func By default, each label is placed in the middle of the edge and rotated to match the edge rotation. The rotation for each label can be overwritten with the `elabels_rotation` argument. =# -p.elabels_rotation[] = Dict(i => i == 5 ? 0.0 : Makie.automatic for i in 1:ne(g)) +p.elabels_rotation[] = Dict(i => i == 2 ? 0.0 : Makie.automatic for i in 1:ne(g)) nothing #hide #= @@ -126,7 +127,7 @@ One can shift the label along the edge with the `elabels_shift` argument and det in pixels using the `elabels_distance` argument. =# -p.elabels_side[] = Dict(i => :right for i in [1,2,8,6]) +p.elabels_side[] = Dict(i => :right for i in [6,7]) p.elabels_offset[] = [Point2f(0.0, 0.0) for i in 1:ne(g)] p.elabels_offset[][5] = Point2f(-0.4,0) p.elabels_offset[] = p.elabels_offset[] @@ -181,7 +182,7 @@ hidedecorations!(ax); hidespines!(ax); ax.aspect = DataAspect() # It is possible to change the appearance using the `selfedge_` attributes: p.selfedge_size = Dict(1=>Makie.automatic, 4=>3.6, 6=>0.5) #idx as in edges(g) -p.selfedge_direction = Point2f(0.3, 1) +p.selfedge_direction = Point2f(-0.25, -0.3) p.selfedge_width = Any[Makie.automatic for i in 1:ne(g)] p.selfedge_width[][4] = 0.6*π; notify(p.selfedge_width) autolimits!(ax) @@ -218,7 +219,7 @@ It is also possible to specify the distance on a per edge base: g = complete_digraph(3) distances = collect(0.05:0.05:ne(g)*0.05) elabels = "d = ".* repr.(round.(distances, digits=2)) -f, ax, p = graphplot(g; curve_distance=distances, elabels, arrow_size=20) +f, ax, p = graphplot(g; curve_distance=distances, elabels, arrow_size=20, elabels_distance=15) hidedecorations!(ax); hidespines!(ax); ax.aspect = DataAspect() @save_reference f #hide @@ -307,12 +308,8 @@ experimental. Feel free to file an issue if there are any problems. =# set_theme!(size=(800, 800)) #hide g = smallgraph(:cubical) -elabels_shift = [0.5 for i in 1:ne(g)] -elabels_shift[[2,7,8,9]] .= 0.3 -elabels_shift[10] = 0.25 f, ax, p = graphplot(g; layout=Spring(dim=3, seed=5), elabels="Edge ".*repr.(1:ne(g)), - elabels_shift, arrow_show=true, arrow_shift=0.9, arrow_size=15) diff --git a/docs/examples/reftests.jl b/docs/examples/reftests.jl index 66bc8769..693ee146 100644 --- a/docs/examples/reftests.jl +++ b/docs/examples/reftests.jl @@ -126,12 +126,13 @@ graphplot(fig[1,2], ) hidedecorations!(current_axis()) -graphplot(fig[2,1], +graphplot(fig[2,1], layout=Stress(), DiGraph([Edge(1 => 2), Edge(2 => 3), Edge(3=>4), Edge(4=>1)]), edge_attr = (; linestyle = Linestyle([0.5, 1.0, 1.5, 2.5])), edge_plottype = :beziersegments, ) hidedecorations!(current_axis()) +fig @save_reference fig # ## Self loop with waypoints diff --git a/docs/examples/scenegraph.jl b/docs/examples/scenegraph.jl index f9811b08..fb52216f 100644 --- a/docs/examples/scenegraph.jl +++ b/docs/examples/scenegraph.jl @@ -64,7 +64,7 @@ end ## This is a utility function for the label, to avoid ## the cruft that comes from excessive type printing. label_str(::Scene) = "Scene" -label_str(::Makie.Combined{F, T}) where {F, T} = string(F) # get only the plot func, not the argument type +label_str(::Plot{F}) where {F} = string(F) # get only the plot func, not the argument type nothing #hide diff --git a/docs/make.jl b/docs/make.jl index 67e0fba3..1dcac819 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -9,6 +9,10 @@ using NetworkDynamics using LayeredLayouts using Graphs using RegistryInstances +using NetworkLayout +using StableRNGs + +NetworkLayout.DEFAULT_RNG[] = StableRNG DocMeta.setdocmeta!(GraphMakie, :DocTestSetup, :(using GraphMakie); recursive=true) diff --git a/test/referencetests.jl b/test/referencetests.jl index a28f50e0..986aeeb3 100644 --- a/test/referencetests.jl +++ b/test/referencetests.jl @@ -88,11 +88,11 @@ end # equal = ReferenceTests.psnr_equality()(load(old), load(new)) score = compare(load(old), load(new)) - MEH = 48 - GOOD = 200 + MEH = 40 + GOOD = 90 # basicially disable check on older julia versions - if VERSION < v"1.10" + if VERSION < v"1.11" MEH = 0; end diff --git a/test/runtests.jl b/test/runtests.jl index 34f9611f..149dca04 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,6 +5,9 @@ using GraphMakie.NetworkLayout using Makie.Colors using StaticArrays using Test +using StableRNGs + +NetworkLayout.DEFAULT_RNG[] = StableRNG include("beziercurves_test.jl")