diff --git a/docs/src/tutorials/butterfly.md b/docs/src/tutorials/butterfly.md index 3b7c19e76..dc3f286b2 100644 --- a/docs/src/tutorials/butterfly.md +++ b/docs/src/tutorials/butterfly.md @@ -56,7 +56,7 @@ Default is `(:labels, :label, :topoLabels, :sensor, :nothing)` ## Configurations for Butterfly Plots -Here we look into possible options for configuring the butterfly plot visualization using `(...;extra=(=,...)`. +Here we look into possible options for configuring the butterfly plot visualization using `(...; extra=(=, ...)`. This is the list of unique configuration (extraData): - topoLegend (boolean) diff --git a/docs/src/tutorials/designmatrix.md b/docs/src/tutorials/designmatrix.md index d0a857ea6..d194eebc2 100644 --- a/docs/src/tutorials/designmatrix.md +++ b/docs/src/tutorials/designmatrix.md @@ -28,7 +28,7 @@ The following code will result in the default configuration. plot_designmatrix(designmatrix(uf)) ``` -# `plot_designmatrix(...;extra=(=,...)`. +# `plot_designmatrix(...; extra=(=, ...)`. - sortData (boolean,false) - Indicating whether the data is sorted; using sortslices() of Base Julia. diff --git a/docs/src/tutorials/topoplot.md b/docs/src/tutorials/topoplot.md index 7d03f0d21..436d830c1 100644 --- a/docs/src/tutorials/topoplot.md +++ b/docs/src/tutorials/topoplot.md @@ -63,12 +63,12 @@ cfgDefault.mapping.y Indicates whether label should drawn next to their position. Obviously the labels have to be provided: `plot_topoplot(...; labels=[...])` -`plot_topoplot(...;visual=(; label_text=true))` +`plot_topoplot(...; visual=(; label_text=true))` ### label_scatter (boolean) Indicates whether the dots should be drawn at the given positions. -`plot_topoplot(...;visual=(; label_scatter=true))` +`plot_topoplot(...; visual=(; label_scatter=true))` ```@example main diff --git a/docs/src/tutorials/topoplotseries.md b/docs/src/tutorials/topoplotseries.md index 1837724b5..10eacfddb 100644 --- a/docs/src/tutorials/topoplotseries.md +++ b/docs/src/tutorials/topoplotseries.md @@ -27,12 +27,19 @@ nothing #hide plot_topoplotseries(df, Δbin; positions = positions) ``` +With colorbar: + +```@example main +plot_topoplotseries(df, Δbin; positions=positions, layout = (; useColorbar=true)) +``` ### Positions You can give either positions, or labels. If both are provided, positions have priority -### plot_toposeries(...;mapping=(;key=value)) -`mapping=(:y=(:estimate, :yhat, :y))` + +### plot_toposeries(...; mapping=(; key=value)) +`mapping=(: y=(:estimate, :yhat, :y))` + ### visual=(;) `label_text` (boolean, false) Indicates whether label should drawn next to their position. diff --git a/src/plot_circulareegtopoplot.jl b/src/plot_circulareegtopoplot.jl index 19ae4ce73..2c5442f67 100644 --- a/src/plot_circulareegtopoplot.jl +++ b/src/plot_circulareegtopoplot.jl @@ -1,7 +1,7 @@ """ - plot_circulareegtopoplot(plotData::DataFrame;kwargs...) - plot_circulareegtopoplot!(figlike, plotData::DataFrame;kwargs...) + plot_circulareegtopoplot(plotData::DataFrame; kwargs...) + plot_circulareegtopoplot!(figlike, plotData::DataFrame; kwargs...) @@ -13,15 +13,15 @@ Plot a circular EEG topoplot. - `predictor` (optional; default :predictor) the circular predictor value, defines position of topoplot, is mapped around `predictorBounds` - `kwargs...`: Additional styling behavior. -## Extra Data Behavior (...;extra=(;[key]=value)): +## Extra Data Behavior (...; extra=(; [key]=value)): `predictorBounds`: Default: `[0,360]` - The bounds of the predictor. This is relevant for the axis labels. -## Axis Data Behavior (...;axis=(;[key]=value)): +## Axis Data Behavior (...; axis=(; [key]=value)): `label`: default "", the text in the center of the cricle -## Mapping Data Behavior (...;mapping=(;[key]=value)): +## Mapping Data Behavior (...; mapping=(; [key]=value)): ## Return Value: A figure containing the circular topoplot at given layout position diff --git a/src/plot_designmatrix.jl b/src/plot_designmatrix.jl index 2e43a05f0..8049fe36e 100644 --- a/src/plot_designmatrix.jl +++ b/src/plot_designmatrix.jl @@ -1,5 +1,5 @@ """ - function plot_designmatrix(plotData::Unfold.DesignMatrix;kwargs...) + function plot_designmatrix(plotData::Unfold.DesignMatrix; kwargs...) Plot a designmatrix. diff --git a/src/plot_parallelcoordinates.jl b/src/plot_parallelcoordinates.jl index cb97b4a4c..06ddf8e34 100644 --- a/src/plot_parallelcoordinates.jl +++ b/src/plot_parallelcoordinates.jl @@ -8,7 +8,7 @@ Plot a PCP (parallel coordinates plot). - `config::PlotConfig`: Instance of PlotConfig being applied to the visualization. - `channels::Vector{Int64}`: vector with all the channels representing an axis used in the PCP in given order. -## Extra Data Behavior (...;setExtraValues=(;[key]=value)): +## Extra Data Behavior (...; setExtraValues=(; [key]=value)): PCP has problems with size changes of the view window. By adapting the padding, aspect ratio and tick label size in px for a new use case, the PCP can even be added into a Coordinated Multiple Views System diff --git a/src/plot_topoplot.jl b/src/plot_topoplot.jl index 36ecadafd..723937f20 100644 --- a/src/plot_topoplot.jl +++ b/src/plot_topoplot.jl @@ -1,6 +1,6 @@ """ - function plot_topoplot!(f::Union{GridPosition, Figure}, plotData, ; positions=nothing, labels=nothing,kwargs...) - function plot_topoplot(plotData,; positions=nothing, labels=nothing,kwargs...) + function plot_topoplot!(f::Union{GridPosition, Figure}, plotData, ; positions=nothing, labels=nothing, kwargs...) + function plot_topoplot(plotData,; positions=nothing, labels=nothing, kwargs...) Plot a topo plot. ## Arguments: @@ -9,7 +9,7 @@ Plot a topo plot. - `positions::Vector{Point{2, Float32}}=nothing`: positions used if `plotData` is no DataFrame. If this is the case and `positions=nothing` then positions is generated from `labels`. - `labels::Vector{String}=nothing`: labels used if `plotData` is no DataFrame. -## Extra Data Behavior (...;setExtraValues=(;[key]=value)): +## Extra Data Behavior (...; setExtraValues=(; [key]=value)): None ## Return Value: diff --git a/src/plot_topoplotseries.jl b/src/plot_topoplotseries.jl index eb5560f69..28e775df7 100644 --- a/src/plot_topoplotseries.jl +++ b/src/plot_topoplotseries.jl @@ -1,6 +1,6 @@ """ - function plot_topoplotseries!(f::Union{GridPosition, Figure}, plotData::DataFrame,Δbin::Real;kwargs...) - function plot_topoplotseries!(plotData::DataFrame, Δbin::Real;kwargs...) + function plot_topoplotseries!(f::Union{GridPosition, Figure}, plotData::DataFrame, Δbin::Real; kwargs...) + function plot_topoplotseries!(plotData::DataFrame, Δbin::Real; kwargs...) Plot a Topoplot Series. @@ -8,10 +8,11 @@ Plot a Topoplot Series. - `f::Union{GridPosition, 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 +- `useColorbar`: (default `true`) - show colorbar. - `kwargs...`: Additional styling behavior. Often used: -`plot_topoplotseries(df;mapping=(;col=:time,row=:conditionA))` +`plot_topoplotseries(df; mapping=(;col=:time, row=:conditionA))` -## Extra Data Behavior (...;extra=(;[key]=value)): +## 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... @@ -35,7 +36,7 @@ function plot_topoplotseries!(f::Union{GridPosition,Figure}, plotData::DataFrame positions = getTopoPositions(; positions=positions, labels=labels) - + if "label" ∉ names(plotData) plotData.label = plotData.channel end @@ -45,19 +46,19 @@ function plot_topoplotseries!(f::Union{GridPosition,Figure}, plotData::DataFrame label=:label, col=config.mapping.col, row=config.mapping.row, - col_labels = config.extra.col_labels, - row_labels = config.extra.row_labels, - rasterize_heatmaps = config.extra.rasterize_heatmaps, + col_labels=config.extra.col_labels, + row_labels=config.extra.row_labels, + rasterize_heatmaps=config.extra.rasterize_heatmaps, combinefun=config.extra.combinefun, positions=positions, config.visual... ) - if config.layout.showLegend - @show "leegeeend" + if config.layout.useColorbar + @show "colorbar" d = ftopo.content[1].scene.plots[1] - - Colorbar(f[1,end+1],colormap=d.colormap,colorrange=d.colorrange,height=100) + + Colorbar(f[1, end+1], colormap=d.colormap, colorrange=d.colorrange, height=100, flipaxis=false, label="Voltage [µV]") end return f diff --git a/src/plotconfig.jl b/src/plotconfig.jl index 3c677aba2..2b6106fcd 100644 --- a/src/plotconfig.jl +++ b/src/plotconfig.jl @@ -138,10 +138,10 @@ function PlotConfig(T::Val{:topoplotseries}) config_kwargs!(cfg, extra=( combinefun=mean, col_labels=true, - row_labels = true, + row_labels=true, rasterize_heatmaps=true ), layout=( - showLegend=false, # what does it mean to have a topoplotseries legend? + useColorbar=true, ), visual=(; label_text=false # true doesnt work again ), mapping=( col=(:time,), diff --git a/src/relative_axis.jl b/src/relative_axis.jl index 9cd58ac72..2160428c0 100644 --- a/src/relative_axis.jl +++ b/src/relative_axis.jl @@ -1,20 +1,21 @@ """ -ax = RelativeAxis(figlike, p::NTuple{4,Float64}; kwargs...) +ax = RelativeAxis(figlike, p::NTuple{4, Float64}; kwargs...) Returns an axis which's position is relative to a GridLayout Element (via BBox) and not -relative to the Scene (default Axis(...,bbox=BBox()) behavior) +relative to the Scene (default Axis(..., bbox=BBox()) behavior) p::NTuple{4,Float64}: Give the relative position to the GridPosition, left:right; bottom:up, -typical numbers betwen 0 and 1. E.g. (0.25,0.75,0.25,0.75) would center an Axis inside that GridPosition +typical numbers betwen 0 and 1. E.g. (0.25, 0.75, 0.25, 0.75) would center an Axis inside that GridPosition kwargs... are pasted into Axis f = Figure() -ax = RelativeAxis(f[1,2],(0.25,0.75,0.25,0.75)) # returns Axis centered within f[1,2] +ax = RelativeAxis(f[1,2], (0.25, 0.75, 0.25, 0.75)) # returns Axis centered within f[1,2] """ + struct RelativeAxis layoutobservables::GridLayoutBase.LayoutObservables{GridLayout} relative_bbox::NTuple diff --git a/test/test_toposeries.jl b/test/test_toposeries.jl index 324df5148..93bbee8ef 100644 --- a/test/test_toposeries.jl +++ b/test/test_toposeries.jl @@ -1,8 +1,15 @@ -@testset "testing calculateBBox" begin +@testset "testing standart" begin data, positions = TopoPlots.example_data() df = UnfoldMakie.eeg_matrix_to_dataframe(data[:, :, 1], string.(1:length(positions))); Δbin=80 UnfoldMakie.plot_topoplotseries(df, Δbin; positions=positions) end +@testset "testing with colorbar" begin + data, positions = TopoPlots.example_data() + df = UnfoldMakie.eeg_matrix_to_dataframe(data[:, :, 1], string.(1:length(positions))); + Δbin=80 + UnfoldMakie.plot_topoplotseries(df, Δbin; positions=positions, layout = (; useColorbar=true)) + +end \ No newline at end of file