Interactive plot of fNIRS data

less than 1 minute read

Published:

The quickest way to plot ETG-4000 data in R is plot_ETG4000() from the fnirsr package. But if you want to explore your data in more detail, an interactive plot works better.

I used the dygraphs package for the chart below. With a lot of channels, the legend colours can get muddled, as they do in my example — I haven’t yet worked out how to add a custom palette that copes with that many channels.

Either way, this snippet should be enough to get you started with interactive charts. I haven’t wired it into the main plotting function (plot_ETG4000) yet, but I might in a future release.

The code used to generate the chart is here: PS: the dygraph rendered fine in the interactive window, in R notebooks, and when knitting. When I used Save as Web Page from RStudio, though, I hit a header error and had to clean the generated HTML file by removing a stray <!DOCTYPE html> tag.