Skip to content

Commit

Permalink
applying Linrange for ticks in erpimage
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdez committed Jan 13, 2025
1 parent c3dc6ab commit 74cea3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions src/plot_erpimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,8 @@ function plot_erpimage!(
!isnothing(to_value(sortindex)) ? @assert(to_value(sortindex) isa Vector{Int}) : ""
ax = Axis(ga[1:4, 1:4]; config.axis...)

ax.yticks = [
1,
size(to_value(data), 2) ÷ 4,
size(to_value(data), 2) ÷ 2,
size(to_value(data), 2) - (size(to_value(data), 2) ÷ 4),
size(to_value(data), 2),
]
ax.yticks = LinRange(1, size(to_value(data), 2), 5)

ax.yticklabelsvisible = true
sortindex = sortindex_management(sortindex, sortvalues, data)
filtered_data = @lift(
Expand Down Expand Up @@ -138,10 +133,14 @@ function ei_meanplot(ax, data, config, f, ga, times, meanplot_axis)

trace = @lift(mean($data, dims = 2)[:, 1])
meanplot_axis = update_axis(supportive_defaults(:meanplot_default); meanplot_axis...)
xticks = @lift(round.(LinRange(minimum($times), maximum($times), 5), digits = 2))
yticks = @lift(round.(LinRange(minimum($trace), maximum($trace), 5), digits = 1))

axbottom = Axis(
ga[5, 1:4];
ylabel = config.colorbar.label === nothing ? "" : config.colorbar.label,
xticks = xticks,
yticks = yticks,
limits = @lift((
minimum($times),
maximum($times),
Expand Down Expand Up @@ -172,10 +171,9 @@ function ei_sortvalue(sortvalues, f, ax, hm, config, sortval_xlabel, sortplot_ax
axleft = Axis(
gb[1:4, 1:5];
xlabel = sortval_xlabel,
xticks = @lift([
round(minimum($sortvalues), digits = 2),
round(maximum($sortvalues), digits = 2),
]),
xticks = @lift(
round.(LinRange(minimum($sortvalues), maximum($sortvalues), 2), digits = 2)
),
limits = @lift((
minimum($sortvalues) - (maximum($sortvalues) / 100 * 3),
maximum($sortvalues) + (maximum($sortvalues) / 100 * 3),
Expand Down
2 changes: 1 addition & 1 deletion test/test_topoplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,6 @@ end
axis = (; xlabel = "50 ms"),
visual = (; colormap = :viridis),
)
colgap!(f.layout, 50)
colgap!(f.layout, 0)
f
end

0 comments on commit 74cea3c

Please sign in to comment.