Skip to content

Commit 3708f82

Browse files
authored
Merge pull request #223 from MakieOrg/hw/makie0.24
[WIP] compat with makie 0.24
2 parents 518a1ba + 6a89422 commit 3708f82

15 files changed

Lines changed: 411 additions & 377 deletions

NEWS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# NEWS
2+
3+
## Breaking Changes
4+
5+
### Version 0.6.0 (Makie 0.24 Compatibility)
6+
7+
**Breaking Changes:**
8+
- **Removed `edge_plottype` parameter**: The `edge_plottype` argument has been removed from `graphplot`. Edge plotting is now handled automatically with improved performance - curved edges (BezierPaths) are now rendered as efficiently as straight edges using a unified plotting system.
9+
10+
**New Features:**
11+
- **Added `edge_linestyle` parameter**: New parameter to control line styles for individual edges. Supports vectors and dictionaries for per-edge customization.
12+
*Performance note*: The new unified edge system maintains optimal performance for both straight and curved edges when using homogeneous linestyles. Only when using different linestyles for different edges (inhomogeneous) does the system fall back to creating separate line plots for each edge, which may reduce performance for graphs with many edges.
13+
14+
**Internal Changes:**
15+
- Refactored reactive system to use `map!` instead of `@lift` macros for better performance and Makie 0.24 compatibility
16+
- Unified edge plotting system replaces separate `linesegments` and `beziersegments` approaches
17+
- Improved interaction system with updated selection handling

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GraphMakie"
22
uuid = "1ecd5474-83a3-4783-bb4f-06765db800d2"
33
authors = ["Simon Danisch", "Hans Würfel"]
4-
version = "0.5.15"
4+
version = "0.6.0"
55

66
[deps]
77
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
@@ -15,13 +15,13 @@ SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
1515
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1616

1717
[compat]
18-
CairoMakie = "0.14"
18+
CairoMakie = "0.15"
1919
DataStructures = "0.17, 0.18"
2020
FileIO = "1"
2121
GeometryBasics = "0.5"
2222
Graphs = "1.4"
2323
Literate = "2"
24-
Makie = "0.23"
24+
Makie = "0.24.3"
2525
NetworkLayout = "0.4.9"
2626
PolynomialRoots = "1"
2727
ReferenceTests = "0.10"

assets/reftests.jl-10.png

7.42 KB
Loading

assets/scenegraph.jl-01.png

-6.69 KB
Loading

docs/Project.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ DecisionTree = "7806a523-6efd-50cb-b5f6-3fa6f1930dbb"
88
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
99
GraphMakie = "1ecd5474-83a3-4783-bb4f-06765db800d2"
1010
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
11-
JSServe = "824d6782-a2ef-11e9-3a09-e5662e0c26f9"
1211
LayeredLayouts = "f4a74d36-062a-4d48-97cd-1356bad1de4e"
1312
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
1413
MLJ = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7"
@@ -21,21 +20,20 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
2120
WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008"
2221

2322
[compat]
24-
CairoMakie = "0.14"
23+
CairoMakie = "0.15"
2524
Cbc = "1"
2625
DataStructures = "0.18"
2726
DecisionTree = "0.12"
2827
Documenter = "1"
2928
GraphMakie = ">= 0.1"
3029
Graphs = "1"
31-
JSServe = "2"
3230
LayeredLayouts = "0.2"
3331
Literate = "2"
3432
MLJ = "0.20"
35-
Makie = "0.23"
33+
Makie = "0.24"
3634
NetworkDynamics = "0.9"
3735
NetworkLayout = "0.4.7"
3836
OrdinaryDiffEqTsit5 = "1"
3937
RegistryInstances = "0.1"
4038
StableRNGs = "1"
41-
WGLMakie = "0.12"
39+
WGLMakie = "0.13"

docs/examples/plots.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ax.aspect = DataAspect()
2121
The `graphplot` command is a recipe which wraps several steps
2222
- layout the graph in space using a layout function,
2323
- create a `scatter` plot for the nodes and
24-
- create a `linesegments` plot for the edges.
24+
- create a `lines` plot for the edges.
2525
2626
The default layout is `Spring()` from
2727
[`NetworkLayout.jl`](https://github.com/JuliaGraphs/NetworkLayout.jl). The
@@ -62,7 +62,7 @@ p.layout = fixed_layout; autolimits!(ax)
6262
## change edge width & color
6363
p.edge_width = 5.0
6464
p.edge_color[][3] = :green;
65-
p.edge_color = p.edge_color[] # trigger observable
65+
p.edge_color[] = p.edge_color[] # trigger observable
6666
@save_reference f #hide
6767

6868
#=
@@ -316,12 +316,9 @@ f, ax, p = graphplot(g; layout=Spring(dim=3, seed=5),
316316
@save_reference f #hide
317317

318318
#=
319-
Using [`JSServe.jl`](https://github.com/SimonDanisch/JSServe.jl) and [`WGLMakie.jl`](https://github.com/MakieOrg/Makie.jl/tree/master/WGLMakie)
319+
Using [`WGLMakie.jl`](https://github.com/MakieOrg/Makie.jl/tree/master/WGLMakie)
320320
we can also add some interactivity:
321321
=#
322-
using JSServe #md
323-
Page(exportable=true, offline=true) #md
324-
#
325322
using WGLMakie #md
326323
WGLMakie.activate!() #md
327324
set_theme!(size=(800, 600)) #md

docs/examples/reftests.jl

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,19 @@ autolimits!(ax); hidedecorations!(ax); hidespines!(ax); ylims!(-5,1)
114114
fig = Figure()
115115
graphplot(fig[1,1],
116116
DiGraph([Edge(1 => 2), Edge(2 => 3)]),
117-
edge_attr = (; linestyle = [:dot, :dash]),
118-
edge_plottype = :beziersegments,
117+
edge_linestyle = [:dot, :dash],
119118
)
120119
hidedecorations!(current_axis())
121120

122121
graphplot(fig[1,2],
123122
DiGraph([Edge(1 => 2), Edge(2 => 1)]),
124-
edge_attr = (; linestyle = [:dot, :dash]),
125-
edge_plottype = :beziersegments,
123+
edge_linestyle = [:dot, :dash],
126124
)
127125
hidedecorations!(current_axis())
128126

129127
graphplot(fig[2,1], layout=Stress(),
130128
DiGraph([Edge(1 => 2), Edge(2 => 3), Edge(3=>4), Edge(4=>1)]),
131-
edge_attr = (; linestyle = Linestyle([0.5, 1.0, 1.5, 2.5])),
132-
edge_plottype = :beziersegments,
129+
edge_linestyle = Linestyle([0.5, 1.0, 1.5, 2.5]),
133130
)
134131
hidedecorations!(current_axis())
135132
fig
@@ -159,15 +156,15 @@ hidedecorations!(ax)
159156
@save_reference fig
160157

161158
p.node_size[][1] = 40
162-
notify(p.node_size)
159+
p.node_size[] = p.node_size[]
163160
@save_reference fig
164161

165162
p.arrow_size[][3] = 40
166-
notify(p.arrow_size)
163+
p.arrow_size[] = p.arrow_size[]
167164
@save_reference fig
168165

169166
p.node_pos[][1] = (0,0)
170-
notify(p.node_pos)
167+
p.node_pos[] = p.node_pos[]
171168
@save_reference fig
172169

173170
# test large nodes
@@ -200,9 +197,9 @@ hidedecorations!(ax)
200197
@save_reference fig
201198

202199
# Update observables
203-
p[:ilabels][][1] = "1111"
204200
p.node_size[] = DefaultDict(Makie.automatic, Dict{Int, Any}(2=>100))
205-
notify(p[:ilabels])
201+
p[:ilabels][][1] = "1111"
202+
p[:ilabels][] = p[:ilabels][]
206203
@save_reference fig
207204

208205
p[:ilabels_fontsize][] = 10

docs/examples/truss.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ record(fig, "truss.mp4", trange; framerate=fps) do t
154154
for i in eachindex(pos0)
155155
p[:node_pos][][i] = (s_at_t.v[i, :x], s_at_t.v[i, :y])
156156
end
157-
notify(p[:node_pos])
157+
p[:node_pos][] = p[:node_pos][]
158158
load = s_at_t.e[:, :Fabs]
159159
p.edge_color[] = load
160160
p.elabels = [@sprintf("%.0f", l) for l in load]

docs/make.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ using Literate
44
using CairoMakie
55

66
# preload the deps from the examples to supress precompilation output in docs
7-
using JSServe
87
using NetworkDynamics
98
using LayeredLayouts
109
using Graphs

src/GraphMakie.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module GraphMakie
33
using NetworkLayout
44
using Graphs
55
using Makie
6+
using Makie: add_input!, add_constant!
67
using LinearAlgebra
78
using SimpleTraits
89

0 commit comments

Comments
 (0)