-
Notifications
You must be signed in to change notification settings - Fork 7
/
position2color.jl
56 lines (41 loc) · 1.42 KB
/
position2color.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# # [Change colormap of Butterfly plot ](@id pos2color)
# You want to change the colors of the lines and markers on the inserted topoplot.
# To do that you need to change the color scheme (aka color map) of the butterfly plot.
# # Setup
using UnfoldMakie
using CairoMakie
using DataFramesMeta
using Colors
# By default the plot looks like this:
include("../../../example_data.jl")
results, positions = example_data("TopoPlots.jl")
plot_butterfly(results; positions = positions)
# # Color schemes
# ## MNE style
#=
We can change the color scale by specifying a function that maps from an `(x,y)` tuple to a color. UnfoldMakie currently provides three different color scales:
- `pos2colorRGB` (same as MNE-Python),
- pos2colorHSV` (HSV color space),
- pos2colorRomaO`.
While `RGB` & `HSV` have the advantage of being 2D color maps, `Roma0` has the advantage of being perceptually uniform.
Also you can specify a uniform color.
=#
plot_butterfly(
results;
positions = positions,
topopositions_to_color = pos -> UnfoldMakie.pos_to_color_RGB(pos),
)
# ## HSV-Space
plot_butterfly(
results;
positions = positions,
topopositions_to_color = UnfoldMakie.pos_to_color_HSV,
)
# ## Uniform Color
# You can make all lines "gray", or any other arbitrary color.
# Also you can make it a function of electrode position.
plot_butterfly(
results;
positions = positions,
topopositions_to_color = x -> Colors.RGB(0.5),
)