I found the documentation on kwargs
to be a little terse… how can I exploit keyword arguments to avoid copying tons of different keyword arguments when passing them function to function?
my example below. seems unnatural to write out so many keyword arguments and keep track of them in two places. or is this what needs done? note _viz_posterior_fit!
will be called elsewhere. thx for tips/insights. will pass on to my students
function _viz_posterior_fit!(ax::Axis, data::DataFrame, bayes_res::NamedTuple;
show_bands::Bool=true,
show_function_samples::Bool=false,
show_unobs_data::Bool=true,
show_model::Bool=true,
show_legend::Bool=true)
# tons of code to modify ax
end
function viz_posterior_fit(data::DataFrame, bayes_res::NamedTuple;
show_bands::Bool=true,
show_function_samples::Bool=false,
show_unobs_data::Bool=true,
show_model::Bool=true,
show_legend::Bool=true,
savename::Union{Nothing, String}=nothing)
fig = Figure()
ax = Axis(fig[1, 1], xlabel="time [min]", ylabel="mass uptake [ng/cm²]")
_viz_posterior_fit!(ax, data, bayes_res;
show_bands=show_bands, show_function_samples=show_function_samples, show_unobs_data=show_unobs_data, show_model=show_model, show_legend=show_legend)
if ! isnothing(savename)
save(savename * "_i_obs$(bayes_res.i_obs).pdf", fig)
end
return fig
end