Skip to content

Commit

Permalink
fixes #66,#67,#64,#63
Browse files Browse the repository at this point in the history
  • Loading branch information
behinger committed Sep 11, 2023
1 parent 27dc20d commit bc63357
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
14 changes: 13 additions & 1 deletion src/eeg-series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ function eeg_topoplot_series!(fig, data::DataFrame,
col=:time,
row=nothing,
combinefun=mean,
bin_labels = false,
rasterize_heatmap = true,
topoplot_attributes...)

# cannot be made easier right now, but Simon promised a simpler solution "soonish"
Expand Down Expand Up @@ -116,12 +118,22 @@ function eeg_topoplot_series!(fig, data::DataFrame,
sel = sel .&& (data_mean[:, row] .== select_row[r]) # subselect
end
df_single = data_mean[sel, :]

# select labels
labels = df_single[:, col_label]
# select data
d_vec = df_single[:, col_y]
# plot it
eeg_topoplot!(ax, d_vec, labels; topoplot_attributes...)
ax2 = eeg_topoplot!(ax, d_vec, labels; topoplot_attributes...)

if rasterize_heatmap
ax2.plots[1].plots[1].rasterize = true
end
if r == length(select_row) && bin_labels
ax.xlabel = string(df_single.time[1])
ax.xlabelvisible = true

end
end
end
colgap!(fig.layout, 0)
Expand Down
13 changes: 11 additions & 2 deletions src/plot_topoplotseries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Plot a Topoplot Series.
## Extra Data Behavior (...;extra=(;[key]=value)):
`combinefun` (default `mean`) can be used to specify how the samples within `Δbin` are combined.
`bin_labels` (default `true`) - plot the time-window bin size as xlabels at the last row of the plot
`rasterize_heatmaps` (deault `true`) - when saving a svg - enforce rasterization of the plot heatmap. This has the benefit that all lines/points are vectors, except the interpolated heatmap. This is typically what you want, because else you get ~500x500 vectors per topoplot, which makes everything super slow...
## Return Value:
Expand All @@ -39,16 +40,24 @@ function plot_topoplotseries!(f::Union{GridPosition,Figure}, plotData::DataFrame
plotData.label = plotData.channel
end

eeg_topoplot_series!(f, plotData, Δbin;
ftopo = eeg_topoplot_series!(f, plotData, Δbin;
col_y=config.mapping.y,
col_label=:label,
col=config.mapping.col,
row=config.mapping.row,
bin_labels = config.extra.bin_labels,
rasterize_heatmap = config.extra.rasterize_heatmap,
combinefun=config.extra.combinefun,
positions=positions,
config.visual...
)

if config.layout.showLegend
@show "leegeeend"
d = ftopo.content[1].scene.plots[1]

Colorbar(f[1,end+1],colormap=d.colormap,colorrange=d.colorrange,height=100)
end
return f

end
2 changes: 2 additions & 0 deletions src/plotconfig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ function PlotConfig(T::Val{:topoplotseries})
cfg = PlotConfig(:topoplot)
config_kwargs!(cfg, extra=(
combinefun=mean,
bin_labels=true,
rasterize_heatmaps=true
), layout=(
showLegend=false, # what does it mean to have a topoplotseries legend?
), visual=(; label_text=false # true doesnt work again
Expand Down

0 comments on commit bc63357

Please sign in to comment.