@@ -25,16 +25,60 @@ __time_normalization() = :default
2525"""
2626$(TYPEDSIGNATURES)
2727
28+ """
29+ __description () = (:state , :states ,
30+ :costate , :costates ,
31+ :control , :controls ,
32+ :constraint , :constraints , :cons ,
33+ :dual , :duals )
34+
35+ """
36+ $(TYPEDSIGNATURES)
37+
38+ """
39+ function clean (description)
40+ # remove the nouns in plural form
41+ description = replace (description,
42+ :states => :state ,
43+ :costates => :costate ,
44+ :controls => :control ,
45+ :constraints => :cons ,
46+ :constraint => :cons ,
47+ :duals => :dual )
48+ # remove the duplicates
49+ return tuple (Set (description)... )
50+ end
51+
52+ """
53+ $(TYPEDSIGNATURES)
54+
2855Used to set the default value of the plot size.
2956"""
3057function __size_plot (
3158 sol:: CTModels.Solution ,
3259 model:: Union{CTModels.Model,Nothing} ,
3360 control:: Symbol ,
3461 layout:: Symbol ,
62+ description:: Symbol...
3563)
36- if layout === :group
37- if control === :all
64+
65+ # set the default description if not given and then clean it
66+ description = description == () ? __description () : description
67+ description = clean (description)
68+
69+ #
70+ if layout == :group
71+ nb_plots = 0
72+ nb_plots += :state ∈ description ? 1 : 0
73+ nb_plots += :costate ∈ description ? 1 : 0
74+ if :control in description
75+ if control == :components || control == :norm
76+ nb_plots += 1
77+ elseif control === :all
78+ nb_plots += 2
79+ end
80+ end
81+ if control == :all && nb_plots == 4
3882 return (600 , 560 )
3983 else
4084 return (600 , 280 )
@@ -54,6 +98,7 @@ function __size_plot(
5498 nc = model === nothing ? 0 : CTModels. dim_path_constraints_nl (model)
5599 return (600 , 140 * (n + l + nc))
56100 end
101+
57102end
58103
59104"""
0 commit comments