Skip to content

Commit

Permalink
bug fix and better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdez committed Nov 14, 2023
1 parent 781ec58 commit ee53bc2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/src/how_to/mult_vis_in_fig.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ plot_topoplotseries!(f[4, 1:3], d_topo, 0.1; positions=positions, mapping=(; lab
res_effects = effects(Dict(:continuous => -5:0.5:5), uf_deconv)
plot_erp!(f[2, 4:5], res_effects;
mapping=(; y=:yhat, color=:continuous, group=:continuous),
mapping=(; y=:yhat, color=:continuous, group=:continuous,
showLegend=true,
categoricalColor=false,
categoricalGroup=true,
categoricalGroup=true),
legend=(; nbanks=2),
layout=(; legendPosition=:right))
Expand Down
18 changes: 7 additions & 11 deletions src/plotconfig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,14 @@ function config_kwargs!(cfg::PlotConfig; kwargs...)
is_namedtuple = [isa(t,NamedTuple) for t in values(kwargs)]
@debug is_namedtuple
@assert(all(is_namedtuple),
""" Keyword-Argument specification (kwargs...)
All your specified config-groups need to be `NamedTuples`, but: `$(keys(kwargs)[.!is_namedtuple])` was not.
Maybe you forgot the semicolon (;) in your specification? It should be:
plot_example(...;layout = (;showColorbar=true))
and not:
plot_example(...;layout = (showColorbar=true))
""" Keyword argument specification (kwargs...) Specified config groups must be NamedTuples', but $(keys(kwargs)[.!is_namedtuple]) was not.
Maybe you forgot the semicolon (;) at the beginning of your specification? Compare these strings:
plot_example(...; layout = (; showColorbar=true))
plot_example(...; layout = (showColorbar=true))
The former creates a NamedTuple as required, the later doesn't do something helpful in this case.""")
The first is correct and creates a NamedTuple as required. The second is wrong and its call is ignored.""")
list = fieldnames(PlotConfig)#[:layout,:visual,:mapping,:legend,:colorbar,:axis]
keyList = collect(keys(kwargs))
:extra keyList ? @warn("Extra is deprecated in 0.4 and extra-keyword args have to be used directly as key-word arguments") : ""
Expand Down
4 changes: 2 additions & 2 deletions test/test_topoplot.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
data, positions = TopoPlots.example_data()

@testset "testing topoplot" begin
plot_topoplot(data[:, 150, 1]; positions=positions, t=150)
plot_topoplot(data[:, 150, 1]; positions=positions)
end

@testset "testing topoplot" begin
f = Figure()
plot_topoplot!(f[1, 1], data[:, 150, 1]; positions=positions, t=220)
plot_topoplot!(f[1, 1], data[:, 150, 1]; positions=positions)
end

0 comments on commit ee53bc2

Please sign in to comment.