Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Butterfly #62

Merged
merged 20 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/plot_erp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ function plot_erp!(f::Union{GridPosition,Figure}, plotData::DataFrame; positions
# add topoLegend

if (config.extra.topoLegend)
topoAxis = Axis(f_grid, width=Relative(0.25), height=Relative(0.25), halign=0.05, valign=0.95, aspect=1)
topoAxis = Axis(f_grid, width=Relative(config.extra.topowidth), height=Relative(config.extra.topoheigth), halign=0.05, valign=0.95, aspect=1)
topoplotLegend(config, topoAxis, allPositions)
end
# no extra legend
mainAxis = Axis(f_grid; config.axis...)
hidedecorations!(mainAxis, label = false, ticks = false, ticklabels = false)

if isnothing(colors)
drawing = draw!(mainAxis, plotEquation)
Expand Down Expand Up @@ -184,7 +185,7 @@ function topoplotLegend(config, axis, allPositions)
colorrange=(0, length(allPositions)), # add the 0 for the white-first color
colormap=specialColors,
head=(color=:black, linewidth=1, model=topoMatrix),
label_scatter=(markersize=10, strokewidth=0.5,))
label_scatter=(markersize=config.extra.markersize, strokewidth=0.5,))

hidedecorations!(current_axis())
hidespines!(current_axis())
Expand Down
3 changes: 3 additions & 0 deletions src/plotconfig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ function PlotConfig(T::Val{:butterfly})
showLegend=false
), extra=(;
topoLegend=true,
markersize=10,
topowidth=0.25,
topoheigth=0.25,
topoPositionToColorFunction=x -> posToColorRomaO(x)
), mapping=(;
color=(:channel, :channels, :trial, :trials,),
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TopoPlots = "2bdbdf9c-dbd8-403f-947b-1a4e0dd41a7a"
Unfold = "181c99d8-e21b-4ff3-b70b-c233eddec679"
UnfoldSim = "ed8ae6d2-84d3-44c6-ab46-0baf21700804"
4 changes: 3 additions & 1 deletion test/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ using Test
using CairoMakie
using GeometryBasics
using DataFrames
using TopoPlots
using TopoPlots

include("../docs/example_data.jl")
6 changes: 6 additions & 0 deletions test/test_butterfly.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

@testset "markersize change" begin
include("example_data.jl")
data, pos = example_data("TopoPlots.jl")
plot_butterfly(data; positions=pos, extra=(markersize = 10, topoheigth=0.4, topowidth=0.4))
end
1 change: 0 additions & 1 deletion test/test_topoplot.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include("setup.jl")
@testset "testing topoplot" begin
data, positions = TopoPlots.example_data()
plot_topoplot(data[:, 150, 1]; positions=positions, t=150)
Expand Down
3 changes: 1 addition & 2 deletions test/test_toposeries.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# include("../UnfoldMakie/test/test_toposeries.jl")
#include("setup.jl")

@testset "testing calculateBBox" begin
data, positions = TopoPlots.example_data()
df = UnfoldMakie.eeg_matrix_to_dataframe(data[:, :, 1], string.(1:length(positions)));
Expand Down
Loading