@@ -13,7 +13,7 @@ using CairoMakie
1313using TOML
1414
1515function main ():: Nothing
16- CairoMakie. activate! (px_per_unit= 10 )
16+ CairoMakie. activate! (px_per_unit = 10 )
1717 config_path = ARGS [1 ]
1818
1919 cfg = Dict ()
@@ -75,15 +75,25 @@ function plot_one(
7575 gen_x = map ((v) -> parse (Float32, v), inputs)
7676
7777 do_plot (
78- fig, gen_x, func, xlims[1 ], xlims[2 ],
78+ fig,
79+ gen_x,
80+ func,
81+ xlims[1 ],
82+ xlims[2 ],
7983 " $fn_name $gen_name (linear scale)" ,
80- lin_out_file, false ,
84+ lin_out_file,
85+ false ,
8186 )
8287
8388 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 ],
8594 " $fn_name $gen_name (log scale)" ,
86- log_out_file, true ,
95+ log_out_file,
96+ true ,
8797 )
8898end
8999
@@ -97,7 +107,7 @@ function do_plot(
97107 title:: String ,
98108 out_file:: String ,
99109 logscale:: Bool ,
100- ):: Nothing where F<: AbstractFloat
110+ ):: Nothing where { F<: AbstractFloat }
101111 println (" plotting $title " )
102112
103113 # `gen_x` is the values the generator produces. `actual_x` is for plotting a
@@ -116,32 +126,36 @@ function do_plot(
116126 actual_x = LinRange (input_min, input_max, steps)
117127 xscale = identity
118128 end
119-
129+
120130 gen_y = @. func (gen_x)
121131 actual_y = @. func (actual_x)
122132
123- ax = Axis (fig[1 , 1 ], xscale= xscale, title= title)
133+ ax = Axis (fig[1 , 1 ], xscale = xscale, title = title)
124134
125135 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" ,
128142 )
129143 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" ,
132150 )
133- axislegend (ax, position= :rb , framevisible= false )
151+ axislegend (ax, position = :rb , framevisible = false )
134152
135153 save (out_file, fig)
136154 delete! (ax)
137155end
138156
139157" 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}
145159 try
146160 return f (input)
147161 catch
151165
152166# Operations for logarithms that are symmetric about 0
153167C = 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)))
155169sympow10 (x:: Number ) = (10 ^ C) * (10 ^ x - 1 )
156170
157171main ()
0 commit comments