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

8plots #97

Merged
merged 42 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3bb1869
Update plot_erp.jl
vladdez Sep 19, 2023
72e6d4b
new tests, combined plot in docs
vladdez Sep 20, 2023
28687f8
del
vladdez Sep 20, 2023
20cfa16
additional docs problems
vladdez Sep 20, 2023
dc7fd3d
little detail
vladdez Sep 20, 2023
fd13482
dead links
vladdez Sep 21, 2023
bc73746
docstring warnings
vladdez Sep 21, 2023
47c4b19
cross-refs again
vladdez Sep 21, 2023
2bbc565
test
vladdez Sep 21, 2023
fa8a8ec
pp_plot fixed
vladdez Sep 21, 2023
28eafd0
docs errors should be resolved
vladdez Sep 21, 2023
39f43d5
Update hide_deco.md
vladdez Sep 21, 2023
ea756cb
colorbar docs
vladdez Sep 29, 2023
b4687d5
liting
vladdez Sep 29, 2023
a236bb0
add Voltage label
vladdez Sep 29, 2023
2a3383d
Merge branch 'main' into erpPlotDocumentation
vladdez Sep 29, 2023
f1ece45
linting + name consistency
vladdez Oct 2, 2023
85f17d6
Merge branch 'erpPlotDocumentation' of https://github.com/unfoldtoolb…
vladdez Oct 2, 2023
8f0f9c0
formatter
vladdez Oct 13, 2023
aaef662
no extra for circular
vladdez Oct 24, 2023
bb67ed3
no extra toposeries
vladdez Oct 24, 2023
534c0bd
test for design matrix and no extra
vladdez Oct 24, 2023
0313cf7
test
vladdez Oct 24, 2023
dd8769e
no extra for erp
vladdez Oct 24, 2023
f8afc64
del extra in erpimage and parplot
vladdez Oct 24, 2023
1dc2b35
g
vladdez Oct 24, 2023
b6ffa34
Merge branch 'main' into erpPlotDocumentation
vladdez Oct 24, 2023
6966866
citability
vladdez Oct 24, 2023
62f2b37
failed, but I will save it
vladdez Oct 27, 2023
8295681
fixed
vladdez Oct 31, 2023
ac6be39
fixed colorbar in toposeries
vladdez Nov 9, 2023
00db349
small test
vladdez Nov 9, 2023
7a8e13a
merge with main
behinger Nov 10, 2023
1c032f1
review of current test
vladdez Nov 10, 2023
e0eb9f9
Merge branch 'main' into erpgrid
vladdez Nov 10, 2023
4d6daa1
del chanNum argument
vladdez Nov 10, 2023
9e52794
adding Gridlayout option
vladdez Nov 13, 2023
5ca6976
small fixes
vladdez Nov 13, 2023
c12aab3
add new argument to erp plot
vladdez Nov 13, 2023
052af82
colorbar section in configs for toposeries
vladdez Nov 13, 2023
05ee4e7
whatever
vladdez Nov 13, 2023
59918b8
Merge branch 'main' into 8plots
vladdez Nov 13, 2023
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
4 changes: 2 additions & 2 deletions docs/src/tutorials/topoplotseries.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ nothing #hide
plot_topoplotseries(df, Δbin; positions = positions)
```

With colorbar:
Without colorbar:

```@example main
plot_topoplotseries(df, Δbin; positions=positions, layout = (; useColorbar=true))
plot_topoplotseries(df, Δbin; positions=positions, layout = (; useColorbar=false))
```

### Positions
Expand Down
176 changes: 0 additions & 176 deletions src/eeg-series.jl

This file was deleted.

4 changes: 3 additions & 1 deletion src/eeg_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ function eeg_topoplot_series!(
push!(axlist, ax)
end
end
colgap!(fig.layout, 0)
if typeof(fig) != GridLayout
colgap!(fig.layout, 0)
end

return fig, axlist
end
Expand Down
8 changes: 4 additions & 4 deletions src/plot_circulareegtopoplot.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
plot_circulareegtopoplot(plotData::DataFrame;kwargs...)
plot_circulareegtopoplot!(figlike, plotData::DataFrame;kwargs...)
plot_circulareegtopoplot(plotData::DataFrame; kwargs...)
plot_circulareegtopoplot!(figlike, plotData::DataFrame; kwargs...)

Plot a circular EEG topoplot.
## Arguments:

- `figlike::Union{GridPosition, Figure}`: Figure or GridPosition that the plot should be drawn into
- `figlike::Union{GridPosition, GridLayout, Figure}`: Figure or GridPosition that the plot should be drawn into
- `plotData::DataFrame`: Dataframe with keys for data (looks for `:y,:yhat, :estimate`, and :position (looks for `:pos, :positions, :position`),
- `predictor` (optional; default :predictor) the circular predictor value, defines position of topoplot, is mapped around `predictorBounds`
- `predictorBounds`: Default: `[0,360]` - The bounds of the predictor. This is relevant for the axis labels.
Expand All @@ -29,7 +29,7 @@ plot_circulareegtopoplot(plotData::DataFrame; kwargs...) =
plot_circulareegtopoplot!(f, plotData::DataFrame; kwargs...) =
plot_circulareegtopoplot!(f, plotData; kwargs...)
function plot_circulareegtopoplot!(
f::Union{GridPosition,Figure},
f::Union{GridPosition,GridLayout,Figure},
plotData::DataFrame;
predictor = :predictor,
positions = nothing,
Expand Down
6 changes: 4 additions & 2 deletions src/plot_designmatrix.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""
plot_designmatrix(plotData::Unfold.DesignMatrix;kwargs...)
plot_designmatrix!(f::Union{GridPosition, GridLayout, Figure}, plotData::Unfold.DesignMatrix; kwargs...)
plot_designmatrix(plotData::Unfold.DesignMatrix; kwargs...)


Plot a designmatrix.
## Arguments:
- `f::Union{GridPosition, GridLayout, Figure}`: Figure or GridPosition (e.g. f[2, 3]) that the plot should be drawn into. New axis is created.
- `plotData::Unfold.DesignMatrix`: Data for the plot visualization.

## kwargs
Expand All @@ -27,7 +29,7 @@ A figure displaying the designmatrix.
plot_designmatrix(plotData::Unfold.DesignMatrix; kwargs...) =
plot_designmatrix!(Figure(), plotData; kwargs...)
function plot_designmatrix!(
f::Union{GridPosition,Figure},
f::Union{GridPosition,GridLayout,Figure},
plotData::Unfold.DesignMatrix;
xTicks = nothing,
sortData = false,
Expand Down
61 changes: 27 additions & 34 deletions src/plot_erp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ using DataFrames
using TopoPlots
using LinearAlgebra
"""
plot_erp!(f::Union{GridPosition, Figure}, plotData::DataFrame; kwargs...)
plot_erp!(f::Union{GridPosition, GridLayout, Figure}, plotData::DataFrame; kwargs...)
plot_erp(plotData::DataFrame; kwargs...)

Plot an ERP plot.

## Arguments:

- `f::Union{GridPosition, Figure}`: Figure or GridPosition that the plot should be drawn into
- `f::Union{GridPosition, GridLayout, Figure}`: Figure or GridPosition that the plot should be drawn into
- `plotData::DataFrame`: Data for the line plot visualization.
- `kwargs...`: Additional styling behavior. Often used: `plot_erp(df; mapping=(; color=:coefname, col=:conditionA))`

Expand Down Expand Up @@ -47,23 +47,26 @@ see also [`plot_erp`](@Ref)
plot_butterfly(plotData::DataFrame; kwargs...) =
plot_butterfly!(Figure(), plotData; kwargs...)

plot_butterfly!(f::Union{GridPosition,<:Figure}, plotData::DataFrame; kwargs...) =
plot_erp!(
f,
plotData;
butterfly = true,
topoLegend = true,
topomarkersize = 10,
topowidth = 0.25,
topoheigth = 0.25,
topoPositionToColorFunction = x -> posToColorRomaO(x),
kwargs...,
)
plot_butterfly!(
f::Union{GridPosition,GridLayout,<:Figure},
plotData::DataFrame;
kwargs...,
) = plot_erp!(
f,
plotData;
butterfly = true,
topoLegend = true,
topomarkersize = 10,
topowidth = 0.25,
topoheigth = 0.25,
topoPositionToColorFunction = x -> posToColorRomaO(x),
kwargs...,
)



function plot_erp!(
f::Union{GridPosition,Figure},
f::Union{GridPosition,GridLayout,Figure},
plotData::DataFrame;
positions = nothing,
labels = nothing,
Expand All @@ -86,7 +89,6 @@ function plot_erp!(
config_kwargs!(config; kwargs...)
end


plotData = deepcopy(plotData) # XXX why?

# resolve columns with data
Expand Down Expand Up @@ -184,7 +186,12 @@ function plot_erp!(
valign = 0.95,
aspect = 1,
)
topoplotLegend(topoAxis, topomarkersize, topoPositionToColorFunction, allPositions)
topoplotLegend(
topoAxis,
topomarkersize,
topoPositionToColorFunction,
allPositions,
)
end
# no extra legend
mainAxis = Axis(f_grid; config.axis...)
Expand All @@ -203,8 +210,6 @@ function plot_erp!(

end
applyLayoutSettings!(config; fig = f, ax = drawing, drawing = drawing)#, drawing = drawing)


return f

end
Expand All @@ -215,22 +220,10 @@ function eegHeadMatrix(positions, center, radius)
oldRadius, _ = findmax(x -> norm(x .- oldCenter), positions)
radF = radius / oldRadius
return Makie.Mat4f(
radF,
0,
0,
0,
0,
radF,
0,
0,
0,
0,
1,
0,
radF, 0, 0, 0, 0,
radF, 0, 0, 0, 0, 1, 0,
center[1] - oldCenter[1] * radF,
center[2] - oldCenter[2] * radF,
0,
1,
center[2] - oldCenter[2] * radF, 0, 1,
)
end

Expand Down
7 changes: 3 additions & 4 deletions src/plot_erpgrid.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
function plot_erpgrid!(f::Union{GridPosition, Figure}, data::Matrix{<:Real}, pos::Vector{Point{2,Float}}; kwargs...)
function plot_erpgrid!(f::Union{GridPosition, GridLayout, Figure}, data::Matrix{<:Real}, pos::Vector{Point{2,Float}}; kwargs...)
function plot_erpgrid(data::Matrix{<:Real}, pos::Vector{Point{2,Float}}; kwargs...)

Plot an ERP image.
## Arguments:
- `f::Union{GridPosition, Figure}`: Figure or GridPosition that the plot should be drawn into;
- `f::Union{GridPosition, GridLayout, Figure}`: Figure or GridPosition that the plot should be drawn into;
- `plotData::Matrix{<:Real}`: Data for the plot visualization;
- `pos::Vector{Point{2,Float}}`: electrode positions.

Expand All @@ -21,15 +21,14 @@ plot_erpgrid(plotData::Matrix{<:Real}, pos; kwargs...) =
plot_erpgrid!(Figure(), plotData, pos; kwargs...)

function plot_erpgrid!(
f::Union{GridPosition,Figure},
f::Union{GridPosition,GridLayout,Figure},
plotData::Matrix{<:Real},
pos;
drawLabels = false,
times = -1:size(plotData, 2)-2, #arbitrary strat just for fun
kwargs...,
)
chanNum = size(plotData, 1)
println(size(plotData, 1), " ", size(plotData, 2))
plotData = plotData[1:chanNum, :]
pos = hcat([[p[1], p[2]] for p in pos]...)

Expand Down
Loading
Loading