70
70
(TriangularMF (10 , 15 , 20 ), dom_out),
71
71
(GaussianMF (10.0 , 1.5 ), dom_in),
72
72
(TrapezoidalMF (7 , 9 , 10 , 12 ), dom_in),
73
- (TriangularMF (20 , 25 , 30 ), dom_out),
73
+ (TriangularMF (20 , 25 , 30 ), dom_out)
74
74
]
75
75
76
76
titles = [
82
82
" tip is average" ,
83
83
" service is excellent" ,
84
84
" food is delicious" ,
85
- " tip is generous" ,
85
+ " tip is generous"
86
86
]
87
87
88
- for (p, d, t) in zip (rec, data, titles)
88
+ for (i, ( p, d, t)) in enumerate ( zip (rec, data, titles) )
89
89
@test p. args == d
90
90
if isempty (d)
91
91
@test p. plotattributes == Dict (:plot_title => " tipper" , :grid => false ,
92
- :legend => false , :axis => false , :layout => (3 , 3 ),
93
- :size => (900 , 600 ))
92
+ :legend => false , :axis => false , :layout => (3 , 3 ),
93
+ :size => (900 , 600 ), :subplot => i )
94
94
else
95
95
@test p. plotattributes ==
96
96
Dict (:plot_title => " tipper" , :size => (900 , 600 ), :title => t,
97
- :layout => (3 , 3 ))
97
+ :layout => (3 , 3 ), :subplot => i )
98
98
end
99
99
end
100
100
end
@@ -103,23 +103,25 @@ end
103
103
mfnames = [:average , :generous ]
104
104
mfs = [
105
105
ConstantSugenoOutput (15 ),
106
- LinearSugenoOutput (Dictionary ([:service , :food ], [2.0 , 0.5 ]), 5.0 ),
106
+ LinearSugenoOutput (Dictionary ([:service , :food ], [2.0 , 0.5 ]), 5.0 )
107
107
]
108
108
var = Variable (Domain (0 , 30 ), Dictionary (mfnames, mfs))
109
109
plts = RecipesBase. apply_recipe (Dict {Symbol, Any} (), var, :tip )
110
110
for (plt, mfname, mf) in zip (plts, mfnames, mfs)
111
111
@test plt. args == (mf, Domain (0 , 30 ))
112
112
@test plt. plotattributes == Dict (:plot_title => " tip" , :legend => false ,
113
- :title => string (mfname), :layout => (1 , 2 ))
113
+ :title => string (mfname), :layout => (1 , 2 ))
114
114
end
115
115
end
116
116
117
117
@testset " Plotting type-2 membership functions" begin
118
118
mf = 0.5 * TriangularMF (1 , 2 , 3 ) .. TriangularMF (0 , 2 , 4 )
119
- plt = RecipesBase. apply_recipe (Dict {Symbol, Any} (), mf, 0 , 4 ) |> only
120
- @test plt. args[1 ](0.0 ) == mf. lo (0.0 )
121
- @test keys (plt. plotattributes) == Set ([:fillrange , :legend , :fillalpha , :linealpha ])
122
- @test plt. plotattributes[:fillrange ](0.0 ) == mf. hi (0.0 )
119
+ plt = RecipesBase. apply_recipe (Dict {Symbol, Any} (), mf, 0 , 4 )
120
+ @test plt[1 ]. args[1 ](0.0 ) == mf. lo (0.0 )
121
+ @test keys (plt[1 ]. plotattributes) ==
122
+ Set ([:fillrange , :legend , :fillalpha , :linewidth , :linealpha ])
123
+ @test plt[1 ]. plotattributes[:fillrange ](0.0 ) == mf. hi (0.0 )
124
+ @test plt[2 ]. args[1 ](2 ) == 1.0
123
125
end
124
126
125
127
# @testset "Plotting generating surface" begin
0 commit comments