Created
July 1, 2022 07:58
-
-
Save jkrumbiegel/668473140b309abb4210a628932bc8c2 to your computer and use it in GitHub Desktop.
glmakie row selection heatmap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GLMakie | |
data = Observable(randn(30, 30)) | |
lineindex = Observable(1) | |
linedata = @lift $data[:, $lineindex] | |
f, ax, hm = heatmap(data, axis = (; aspect = 1)) | |
selectionrect = @lift Rect2f(0.5, $lineindex-0.5, size($data, 1), 1) | |
wireframe!(selectionrect, color = :white) | |
lines(f[1, 2], linedata) | |
register_interaction!(ax, :my_interaction) do event::MouseEvent, axis | |
if event.type === MouseEventTypes.leftclick | |
i = round(Int, event.data[2]) | |
if 1 <= i <= size(data[], 1) | |
lineindex[] = i | |
end | |
end | |
end | |
f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment