@@ -13,7 +13,7 @@ using CairoMakie
13
13
using TOML
14
14
15
15
function main ():: Nothing
16
- CairoMakie. activate! (px_per_unit= 10 )
16
+ CairoMakie. activate! (px_per_unit = 10 )
17
17
config_path = ARGS [1 ]
18
18
19
19
cfg = Dict ()
@@ -75,15 +75,25 @@ function plot_one(
75
75
gen_x = map ((v) -> parse (Float32, v), inputs)
76
76
77
77
do_plot (
78
- fig, gen_x, func, xlims[1 ], xlims[2 ],
78
+ fig,
79
+ gen_x,
80
+ func,
81
+ xlims[1 ],
82
+ xlims[2 ],
79
83
" $fn_name $gen_name (linear scale)" ,
80
- lin_out_file, false ,
84
+ lin_out_file,
85
+ false ,
81
86
)
82
87
83
88
do_plot (
84
- fig, gen_x, func, xlims_log[1 ], xlims_log[2 ],
89
+ fig,
90
+ gen_x,
91
+ func,
92
+ xlims_log[1 ],
93
+ xlims_log[2 ],
85
94
" $fn_name $gen_name (log scale)" ,
86
- log_out_file, true ,
95
+ log_out_file,
96
+ true ,
87
97
)
88
98
end
89
99
@@ -97,7 +107,7 @@ function do_plot(
97
107
title:: String ,
98
108
out_file:: String ,
99
109
logscale:: Bool ,
100
- ):: Nothing where F<: AbstractFloat
110
+ ):: Nothing where { F<: AbstractFloat }
101
111
println (" plotting $title " )
102
112
103
113
# `gen_x` is the values the generator produces. `actual_x` is for plotting a
@@ -116,32 +126,36 @@ function do_plot(
116
126
actual_x = LinRange (input_min, input_max, steps)
117
127
xscale = identity
118
128
end
119
-
129
+
120
130
gen_y = @. func (gen_x)
121
131
actual_y = @. func (actual_x)
122
132
123
- ax = Axis (fig[1 , 1 ], xscale= xscale, title= title)
133
+ ax = Axis (fig[1 , 1 ], xscale = xscale, title = title)
124
134
125
135
lines! (
126
- ax, actual_x, actual_y, color= (:lightblue , 0.6 ),
127
- linewidth= 6.0 , label= " true function" ,
136
+ ax,
137
+ actual_x,
138
+ actual_y,
139
+ color = (:lightblue , 0.6 ),
140
+ linewidth = 6.0 ,
141
+ label = " true function" ,
128
142
)
129
143
scatter! (
130
- ax, gen_x, gen_y, color= (:darkblue , 0.9 ),
131
- markersize= markersize, label= " checked inputs" ,
144
+ ax,
145
+ gen_x,
146
+ gen_y,
147
+ color = (:darkblue , 0.9 ),
148
+ markersize = markersize,
149
+ label = " checked inputs" ,
132
150
)
133
- axislegend (ax, position= :rb , framevisible= false )
151
+ axislegend (ax, position = :rb , framevisible = false )
134
152
135
153
save (out_file, fig)
136
154
delete! (ax)
137
155
end
138
156
139
157
" Apply a function, returning the default if there is a domain error"
140
- function map_or (
141
- input:: AbstractFloat ,
142
- f:: Function ,
143
- default:: Any
144
- ):: Union{AbstractFloat,Any}
158
+ function map_or (input:: AbstractFloat , f:: Function , default:: Any ):: Union{AbstractFloat,Any}
145
159
try
146
160
return f (input)
147
161
catch
151
165
152
166
# Operations for logarithms that are symmetric about 0
153
167
C = 10
154
- symlog10 (x:: Number ) = sign (x) * (log10 (1 + abs (x)/ (10 ^ C)))
168
+ symlog10 (x:: Number ) = sign (x) * (log10 (1 + abs (x) / (10 ^ C)))
155
169
sympow10 (x:: Number ) = (10 ^ C) * (10 ^ x - 1 )
156
170
157
171
main ()
0 commit comments