From a855d9c3e3b1c42ecb459e31d8790b68d0cef3e0 Mon Sep 17 00:00:00 2001 From: Vladimir Mikheev Date: Fri, 20 Sep 2024 21:42:14 +0000 Subject: [PATCH] also for plot_erpimage --- src/docstring_template.jl | 10 ++++++++++ src/plot_erpimage.jl | 16 +++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/docstring_template.jl b/src/docstring_template.jl index 64153c424..34c6c805b 100644 --- a/src/docstring_template.jl +++ b/src/docstring_template.jl @@ -84,5 +84,15 @@ function indiv_docstrings(cfg_symb::Symbol) valign = 0.95, aspect = 1, ) + # plot_erpimage + elseif cfg_symb == :meanplot_default + return (; + height = 100, + xlabel = "Time [s]", + xlabelpadding = 0, + xautolimitmargin = (0, 0), + ) + elseif cfg_symb == :sortplot_default + return (; ylabelvisible = true, yticklabelsvisible = false) end end diff --git a/src/plot_erpimage.jl b/src/plot_erpimage.jl index 7847c796d..2cbd490e3 100644 --- a/src/plot_erpimage.jl +++ b/src/plot_erpimage.jl @@ -33,10 +33,12 @@ Plot an ERP image. If `sortvalues = true` the default text will change to "Sorted trials", but it could be changed to any values specified manually. - `meanplot_axis::NamedTuple = (;)`\\ Here you can flexibly change configurations of meanplot.\\ - To see all options just type `?Axis` in REPL. + To see all options just type `?Axis` in REPL.\\ + Defaults: $(indiv_docstrings(:meanplot_default)) - `sortplot_axis::NamedTuple = (;)`\\ Here you can flexibly change configurations of meanplot.\\ - To see all options just type `?Axis` in REPL. + To see all options just type `?Axis` in REPL.\\ + Defaults: $(indiv_docstrings(:sortplot_default)) $(_docstring(:erpimage)) @@ -134,13 +136,11 @@ function ei_meanplot(ax, data, config, f, ga, times, meanplot_axis) ax.xticklabelsvisible = false trace = @lift(mean($data, dims = 2)[:, 1]) + meanplot_axis = update_axis(indiv_docstrings(:meanplot_default); meanplot_axis...) + axbottom = Axis( ga[5, 1:4]; - height = 100, ylabel = config.colorbar.label === nothing ? "" : config.colorbar.label, - xlabel = "Time [s]", - xlabelpadding = 0, - xautolimitmargin = (0, 0), limits = @lift(( minimum($times), maximum($times), @@ -163,11 +163,10 @@ function ei_sortvalue(sortvalues, f, ax, hm, config, sortval_xlabel, sortplot_ax error("`show_sortval` can not take `sortvalues` with all NaN-values") end gb = f[1, 3] = GridLayout() + sortplot_axis = update_axis(indiv_docstrings(:sortplot_default); sortplot_axis...) axleft = Axis( gb[1:4, 1:5]; xlabel = sortval_xlabel, - ylabelvisible = true, - yticklabelsvisible = false, #xautolimitmargin = (-1, 1), #yautolimitmargin = (1, 100), xticks = @lift([ @@ -188,7 +187,6 @@ function ei_sortvalue(sortvalues, f, ax, hm, config, sortval_xlabel, sortplot_ax hidedecorations!(axempty) hidespines!(axempty) hidespines!(axleft, :r, :t) - #scatter!(axleft, xs, ys) lines!(axleft, xs, ys) if config.layout.use_colorbar != false Colorbar(