diff --git a/docs/make.jl b/docs/make.jl index ae105a963..fc4912fb5 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -12,7 +12,7 @@ using Literate using Glob GENERATED = joinpath(@__DIR__, "src", "literate") -for subfolder ∈ ["explanations","HowTo","tutorials"] +for subfolder ∈ ["explanations","HowTo","tutorials","reference"] local SOURCE_FILES = Glob.glob(subfolder*"/*.jl", GENERATED) foreach(fn -> Literate.markdown(fn, GENERATED*"/"*subfolder), SOURCE_FILES) @@ -61,6 +61,9 @@ makedocs(; "Include multiple Visualizations in one Figure" => "how_to/mult_vis_in_fig.md", "Show out of Bounds Label" => "how_to/show_oob_labels.md", ], + "Reference" => [ + "Convert 3D positions / montages to 2D layouts" => "literate/reference/positions.jl" + ] ], ) diff --git a/docs/src/literate/reference/positions.jl b/docs/src/literate/reference/positions.jl index bc3c9a9fa..78ccf2d79 100644 --- a/docs/src/literate/reference/positions.jl +++ b/docs/src/literate/reference/positions.jl @@ -1,4 +1,5 @@ using UnfoldMakie +using CairoMakie using TopoPlots using PyMNE @@ -20,4 +21,10 @@ pos = UnfoldMakie.toPositions(fake_evoked) # # project from 3D electrode locations to 2D pos3d = hcat(values(pyconvert(Dict,biosemi_montage.get_positions()["ch_pos"]))...) -pos2 = to_positions(pos3d) \ No newline at end of file +pos2 = to_positions(pos3d) + +f = Figure(resolution=(600,300)) +scatter(f[1,1],pos3d[1:2,:]) +scatter(f[1,2],pos2) +f +# as one can see, the "naive" transform of just dropping the third dimension doesnt really work (left). We rather have to project the chanels to a sphere and unfold it (right) \ No newline at end of file