-
Notifications
You must be signed in to change notification settings - Fork 7
/
docstringtemplate.jl
57 lines (51 loc) · 1.78 KB
/
docstringtemplate.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function _docstring(cfg_symb::Symbol)
#pad = maximum(length(string(f)) for f in fieldnames(T))
cfg = PlotConfig(cfg_symb)
fn = fieldnames(PlotConfig)
out = ""
visuallink = Dict(
:erp => `Makie.lines`,
:butterfly => `Makie.lines`,
:paracoord => `Makie.lines`,
:erpgrid => `Makie.lines`,
:designmat => `Makie.heatmap`,
:erpimage => `Makie.heatmap`,
:channelimage => `Makie.heatmap`,
:circeegtopo => `Topoplot.eeg_topoplot`,
:topoplot => `Topoplot.eeg_topoplot`,
:topoplotseries => `Topoplot.eeg_topoplot`,
)
cbarstring =
(cfg_symb == :erp || cfg_symb == :butterfly) ?
"[`AlgebraOfGraphics.colobar!`](@ref)" : "[`Makie.Colorbar`](@ref)"
link = Dict(
:figure => "use `kwargs...` of [`Makie.Figure`](@ref)",
:axis => "use `kwargs...` of [`Makie.Axis`](@ref)",
:legend => "use `kwargs...` of [`Makie.Legend`](@ref)",
:colorbar => "use `kwargs...` of $cbarstring",
:visual => "use `kwargs...` of [`$(visuallink[cfg_symb])`](@ref)",
)
for k = 1:length(fn)
namedtpl = string(Base.getfield(cfg, fn[k]))
addlink = ""
try
addlink = "- *" * link[fn[k]] * "*"
catch
end
namedtpl = replace(namedtpl, "_" => "\\_")
out = out * "**$(fn[k]) =** $(namedtpl) $addlink \n\n"
end
return """## Shared plot configuration options
The shared plot options can be used as follows:
`type = (; key=value, ...))` - for example `plot_x(...; layout = (; show_legend=true, legend_position=:right))`.
Multiple defaults will be cycled until match.
$(out)
"""
end
"""
$(TYPEDSIGNATURES)
$(_docstring(:erp))
"""
function plot_new()
return "b"
end