From 857571a96e64f84e0d30bcc6eb3d8e9745f7038d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Mon, 20 Nov 2023 13:57:46 +0100 Subject: [PATCH] Fix "Plotting fails when there are `EinExpr` nodes in a path whose `head` length is 0" #28 --- ext/EinExprsMakieExt.jl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ext/EinExprsMakieExt.jl b/ext/EinExprsMakieExt.jl index 01cfd53..7d3a36c 100644 --- a/ext/EinExprsMakieExt.jl +++ b/ext/EinExprsMakieExt.jl @@ -82,8 +82,18 @@ function Makie.plot!( kwargs = Dict{Symbol,Any}(kwargs) # configure graphics - get!(() -> log_size ./ maximum(log_size) .* MAX_EDGE_WIDTH, kwargs, :edge_width) - get!(() -> log_size ./ maximum(log_size) .* MAX_ARROW_SIZE, kwargs, :arrow_size) + get!(kwargs, :edge_width) do + map(log_size ./ maximum(log_size) .* MAX_EDGE_WIDTH) do x + iszero(x) ? 4.0 : x + end + end + + get!(kwargs, :arrow_size) do + map(log_size ./ maximum(log_size) .* MAX_ARROW_SIZE) do x + iszero(x) ? 30.0 : x + end + end + get!(() -> log_flops ./ maximum(log_flops) .* MAX_NODE_SIZE, kwargs, :node_size) get!(kwargs, :edge_color, lin_size)