Skip to content

Commit 0ddb82d

Browse files
committed
CTModelsPlots: replace @eval/@layout with local Matrix-based grid to avoid world-age errors; construct layouts as Matrix{Any} in split mode and path-constraints; minor cleanup
1 parent 3b7e027 commit 0ddb82d

File tree

4 files changed

+11
-24
lines changed

4 files changed

+11
-24
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
version:
1414
- '1.10'
1515
- '1.11'
16+
- '1.12'
1617
os:
1718
- ubuntu-latest
1819
arch:

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CTModels"
22
uuid = "34c4fa32-2049-4079-8329-de33c2a22e2d"
33
authors = ["Olivier Cots <olivier.cots@toulouse-inp.fr>"]
4-
version = "0.6.8"
4+
version = "0.6.9"
55

66
[deps]
77
CTBase = "54762871-cc72-4466-b8e8-f6c8b58076cd"

ext/plot.jl

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,6 @@ end
186186
"""
187187
$(TYPEDSIGNATURES)
188188
189-
Return an expression `a{r*h}` to control relative plot height when using custom layouts.
190-
191-
Used for vertical space control in plot trees.
192-
"""
193-
function __height(r::Real)::Expr
194-
i = Expr(:call, :*, r, :h)
195-
a = Expr(:curly, :a, i)
196-
return a
197-
end
198-
199-
"""
200-
$(TYPEDSIGNATURES)
201-
202189
Return an empty plot for a `PlotLeaf`.
203190
204191
Used as a placeholder in layout trees.
@@ -382,11 +369,10 @@ function __initial_plot(
382369
nblines = 0
383370
if (!(node_xp isa EmptyPlot) && !(node_u isa EmptyPlot))
384371
nblines = n + l
385-
a = __height(round(n / nblines; digits=2))
386-
@eval lay = @layout [
387-
$a
388-
b
389-
]
372+
h = round(n / nblines; digits=2)
373+
lay = Matrix{Any}(undef, 2, 1)
374+
lay[1, 1] = (label = :a, width = :auto, height = h)
375+
lay[2, 1] = (label = :b, blank = false)
390376
root = PlotNode(lay, [node_xp, node_u])
391377
elseif !(node_xp isa EmptyPlot)
392378
root = node_xp
@@ -428,11 +414,10 @@ function __initial_plot(
428414
# update the root node
429415
if !(node_cocp isa EmptyPlot)
430416
nblines += nc
431-
c = __height(round(nc / nblines; digits=2))
432-
@eval lay = @layout [
433-
a
434-
$c
435-
]
417+
h = round(nc / nblines; digits=2)
418+
lay = Matrix{Any}(undef, 2, 1)
419+
lay[1, 1] = (label = :a, blank = false)
420+
lay[2, 1] = (label = :b, width = :auto, height = h)
436421
root = PlotNode(lay, [root, node_cocp])
437422
end
438423
end

test/extras/plot_duals.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Revise
12
using CTModels
23
using Plots
34
import CTParser: CTParser, @def

0 commit comments

Comments
 (0)