interactive plot of fNIRS data
This file contains 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
devtools::install_github("erzk/fnirsr") | |
library(dygraphs) | |
library(fnirsr) | |
file_path <- system.file("extdata", "Hitachi_ETG4000_24Ch_Total.csv", package = "fnirsr") | |
ETG_header <- load_ETG4000_header(file_path) | |
rawData <- load_ETG4000_data(file_path, ETG_header) | |
# prepare the events | |
event_lines <- rawData %>% dplyr::filter(Mark > 0) %>% .[[1]] | |
trigger_codes <- rawData %>% dplyr::filter(Mark > 0) %>% .[["Mark"]] | |
# the first column needs to provide indices (x-axis) | |
# the remaining columns hold the data to display (y-axis) | |
df_dg <- rawData[, 1:25] | |
dygraph(df_dg, | |
main = "fNIRS data", | |
xlab = "Samples", | |
ylab = "Intensity") %>% | |
dyEvent(event_lines, trigger_codes, labelLoc = "bottom") %>% | |
dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) %>% | |
dyLegend(width = 650) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment