Skip to content

Commit

Permalink
Merge branch 'main' into kwargsError
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdez authored Nov 14, 2023
2 parents 85e3a58 + 859da2b commit cf9b1fd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
10 changes: 9 additions & 1 deletion src/plot_topoplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ function plot_topoplot!(

eeg_topoplot!(axis, plotData, labels; positions, config.visual...)

config_kwargs!(config, colorbar = (; limits = (min(plotData...), max(plotData...))))
clims = (min(plotData...), max(plotData...))
if clims[1] clims[2]
@warn """The min and max of the value represented by the color are the same, it seems that the data values are identical.
We disable the color bar in this figure.
Note: The identical min and max may cause an interpolation error when plotting the topoplot."""
config_kwargs!(config, layout = (; useColorbar=false,showLegend=false))
else
config_kwargs!(config, colorbar = (; limits = clims))
end
applyLayoutSettings!(config; fig = f)

return f
Expand Down
18 changes: 10 additions & 8 deletions src/plot_topoplotseries.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""
plot_topoplotseries!(f::Union{GridPosition, Figure}, plotData::DataFrame, Δbin::Real; kwargs...)
plot_topoplotseries!(f::Union{GridPosition, GridLayout, Figure}, plotData::DataFrame, Δbin::Real; kwargs...)
plot_topoplotseries!(plotData::DataFrame, Δbin::Real; kwargs...)
Multiple miniature topoplots in regular distances
## 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`: DataFrame with data, needs a `time` column
- `Δbin::Real`: A number for how large one bin should be. Δbin is in units of the `plotData.time` column
- `combinefun` (default `mean`) can be used to specify how the samples within `Δbin` are combined.
Expand Down Expand Up @@ -75,9 +75,10 @@ function plot_topoplotseries!(
f[1, end+1],
colormap = d.colormap,
colorrange = d.colorrange,
height = 100,
flipaxis = false,
label = "Voltage [µV]",
height = config.colorbar.height,
flipaxis = config.colorbar.flipaxis,
labelrotation = config.colorbar.labelrotation,
label = config.colorbar.label,
)
else
# println(fieldnames(typeof((axlist[1]))))
Expand All @@ -86,9 +87,10 @@ function plot_topoplotseries!(
f[:, :][1, length(axlist)+1],
colormap = d.colormap,
colorrange = d.colorrange,
height = 100,
flipaxis = false,
label = "Voltage [µV]",
height = config.colorbar.height,
flipaxis = config.colorbar.flipaxis,
labelrotation = config.colorbar.labelrotation,
label = config.colorbar.label,
)
end
end
Expand Down
4 changes: 1 addition & 3 deletions test/test_all.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,9 @@ end
stderror=true))

plot_butterfly!(f[1, 2], d_topo; positions=positions)

plot_topoplot!(f[2, 1], data[:, 150, 1]; positions=positions)
plot_topoplotseries!(f[2, 2], d_topo, 0.1; positions=positions,visual=(label_scatter=false,), layout = (; useColorbar=true))
plot_topoplotseries!(f[2, 2], d_topo, 0.1; positions=positions, visual=(label_scatter=false,), layout = (; useColorbar=true))
plot_erpgrid!(f[3, 1], data[:, :, 1], pos)


times = -0.099609375:0.001953125:1.0
plot_erpimage!(f[3, 2], times, d_singletrial)
Expand Down

0 comments on commit cf9b1fd

Please sign in to comment.